This commit is contained in:
Zoë Blade 2015-04-01 11:49:51 +01:00
commit 0823325dbb
573 changed files with 40936 additions and 34957 deletions

2
.gitignore vendored
View File

@ -11,8 +11,10 @@
/inp
/nvram
/obj
/roms
/snap
src/regtests/chdman/temp
src/regtests/jedutil/output
/sta
*.pyc
/build

View File

@ -8,6 +8,9 @@ max_line_length = 100
insert_final_newline = true
trim_trailing_whitespace = true
[*.c99.h]
indent_style = space
[*.md]
trim_trailing_whitespace = false
max_line_length = 80

View File

@ -350,8 +350,8 @@
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
#endif
#ifdef __GNUC__
#pragma clang diagnostic ignored "-Wunused-parameter" // warning: unused parameter xxxx
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
#pragma GCC diagnostic ignored "-Wunused-parameter" // warning: unused parameter xxxx
#pragma GCC diagnostic ignored "-Wtype-limits" // warning: comparison is always true due to limited range of data type

View File

@ -92,7 +92,7 @@ static float sdf__edgedf(float gx, float gy, float a)
} else if (a < (1.0-a1)) { // a1 <= a <= 1-a1
df = (0.5f-a)*gx;
} else { // 1-a1 < a <= 1
df = -0.5f*(gx + gy) + sqrt(2.0f*gx*gy*(1.0f-a));
df = -0.5f*(gx + gy) + sqrtf(2.0f*gx*gy*(1.0f-a));
}
}
return df;

View File

@ -187,10 +187,15 @@
#ifndef STBI_NO_STDIO
#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen()
#pragma warning(push)
#pragma warning(disable:4996) // suppress even more warnings about fopen()
#if defined(_MSC_VER) && _MSC_VER >= 1400
# if !defined(_CRT_SECURE_NO_WARNINGS)
# define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen()
# endif
# pragma warning(push)
# pragma warning(disable:4996) // suppress even more warnings about fopen()
# pragma warning(disable:4312) // warning C4312: 'type cast': conversion from 'int' to 'unsigned char *' of greater size
# pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration
# pragma warning(disable:4457) // warning C4457: declaration of 'y' hides function parameter
#endif
#include <stdio.h>
#endif // STBI_NO_STDIO
@ -3249,7 +3254,7 @@ static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int
unsigned char *tga_data;
unsigned char *tga_palette = NULL;
int i, j;
unsigned char raw_data[4];
unsigned char raw_data[4] = {};
int RLE_count = 0;
int RLE_repeating = 0;
int read_next_pixel = 1;

View File

@ -432,6 +432,13 @@ Configuration is `<platform>-<debug/release>[32/64]`. For example:
linux-release32, nacl-debug64, nacl-arm-debug, pnacl-release,
android-release, etc.
Amalgamated build
-----------------
For ease of integration to other build system bgfx library can be built with
single .cpp file. It's only necessary to build [src/amalgamated.cpp](https://github.com/bkaradzic/bgfx/blob/master/src/amalgamated.cpp)
inside different build system.
OculusVR integration
--------------------
@ -568,6 +575,11 @@ with examples:
genie --with-sdl vs2012
**NOTE** Special care is necessary to make custom windowing to work with
multithreaded renderer. Each platform has rules about where renderer can be and
how multithreading interacts with context/device. To disable multithreaded
render use `BGFX_CONFIG_MULTITHREDED=0` preprocessor define.
Tools
-----

View File

@ -592,10 +592,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float sphere[numSpheres][4];
for (uint32_t ii = 0; ii < numSpheres; ++ii)
{
sphere[ii][0] = sin(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f);
sphere[ii][1] = sin(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f);
sphere[ii][2] = cos(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f);
sphere[ii][3] = 1.0f/(2.0f + (sin(time*(ii*0.13f) )*0.5f+0.5f)*2.0f);
sphere[ii][0] = sinf(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f);
sphere[ii][1] = sinf(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f);
sphere[ii][2] = cosf(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f);
sphere[ii][3] = 1.0f/(2.0f + (sinf(time*(ii*0.13f) )*0.5f+0.5f)*2.0f);
}
profUpdate = bx::getHPCounter();

View File

@ -182,9 +182,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
mtx[14] = 0.0f;
float* color = (float*)&data[64];
color[0] = sin(time+float(xx)/11.0f)*0.5f+0.5f;
color[1] = cos(time+float(yy)/11.0f)*0.5f+0.5f;
color[2] = sin(time*3.0f)*0.5f+0.5f;
color[0] = sinf(time+float(xx)/11.0f)*0.5f+0.5f;
color[1] = cosf(time+float(yy)/11.0f)*0.5f+0.5f;
color[2] = sinf(time*3.0f)*0.5f+0.5f;
color[3] = 1.0f;
data += instanceStride;

View File

@ -192,7 +192,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float at[3] = { 0.0f, 0.0f, 0.0f };
float eye[3] = { 0.0f, 0.0f, -7.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd)
@ -227,8 +227,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float lightPosRadius[4][4];
for (uint32_t ii = 0; ii < numLights; ++ii)
{
lightPosRadius[ii][0] = sin( (time*(0.1f + ii*0.17f) + ii*bx::piHalf*1.37f ) )*3.0f;
lightPosRadius[ii][1] = cos( (time*(0.2f + ii*0.29f) + ii*bx::piHalf*1.49f ) )*3.0f;
lightPosRadius[ii][0] = sinf( (time*(0.1f + ii*0.17f) + ii*bx::piHalf*1.37f ) )*3.0f;
lightPosRadius[ii][1] = cosf( (time*(0.2f + ii*0.29f) + ii*bx::piHalf*1.49f ) )*3.0f;
lightPosRadius[ii][2] = -2.5f;
lightPosRadius[ii][3] = 3.0f;
}
@ -338,7 +338,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
}
}
// Advance to next frame. Rendering thread will be kicked to
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
}

View File

@ -372,6 +372,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::init(
renderers[bx::getHPCounter() % numRenderers] /* randomize renderer */
, BGFX_PCI_ID_NONE
, 0
, &callback // custom callback handler
, &allocator // custom allocator
);
@ -442,7 +444,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float at[3] = { 0.0f, 0.0f, 0.0f };
float eye[3] = { 0.0f, 0.0f, -35.0f };
float view[16];
float proj[16];
bx::mtxLookAt(view, eye, at);
@ -488,7 +490,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::saveScreenShot("temp/frame150");
}
// Advance to next frame. Rendering thread will be kicked to
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
}

View File

@ -167,12 +167,29 @@ int _main_(int /*_argc*/, char** /*_argv*/)
}
}
bgfx::TextureHandle textures3d[] =
const bgfx::Caps* caps = bgfx::getCaps();
const bool texture3DSupported = !!(caps->supported & BGFX_CAPS_TEXTURE_3D);
uint32_t numTextures3d = 0;
bgfx::TextureHandle textures3d[3] = {};
if (texture3DSupported)
{
bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8),
bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f),
bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f),
};
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_COLOR & caps->formats[bgfx::TextureFormat::R8]) )
{
textures3d[numTextures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8);
}
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_COLOR & caps->formats[bgfx::TextureFormat::R16F]) )
{
textures3d[numTextures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f);
}
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_COLOR & caps->formats[bgfx::TextureFormat::R32F]) )
{
textures3d[numTextures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f);
}
}
// Create static vertex buffer.
bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ), PosTexcoordVertex::ms_decl);
@ -188,7 +205,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::ProgramHandle program = loadProgram("vs_update", "fs_update");
bgfx::ProgramHandle programCmp = loadProgram("vs_update", "fs_update_cmp");
bgfx::ProgramHandle program3d = loadProgram("vs_update", "fs_update_3d");
bgfx::ProgramHandle program3d = BGFX_INVALID_HANDLE;
if (texture3DSupported)
{
program3d = loadProgram("vs_update", "fs_update_3d");
}
const uint32_t textureSide = 2048;
@ -271,8 +292,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
for (uint32_t ii = 0, num = bx::uint32_min(10, (uint32_t)quads.size() ); ii < num; ++ii)
{
const PackCube& face = quads.front();
cube.clear(face);
cube.clear(quads.front() );
quads.pop_front();
}
}
@ -399,7 +419,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::submit(1);
}
for (uint32_t ii = 0; ii < BX_COUNTOF(textures3d); ++ii)
for (uint32_t ii = 0; ii < numTextures3d; ++ii)
{
bx::mtxTranslate(mtx, xpos + ii*2.1f, -4.0f, 0.0f);
@ -465,7 +485,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::destroyTexture(textures[ii]);
}
for (uint32_t ii = 0; ii < BX_COUNTOF(textures3d); ++ii)
for (uint32_t ii = 0; ii < numTextures3d; ++ii)
{
bgfx::destroyTexture(textures3d[ii]);
}
@ -474,7 +494,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::destroyTexture(textureCube);
bgfx::destroyIndexBuffer(ibh);
bgfx::destroyVertexBuffer(vbh);
bgfx::destroyProgram(program3d);
if (bgfx::isValid(program3d) )
{
bgfx::destroyProgram(program3d);
}
bgfx::destroyProgram(programCmp);
bgfx::destroyProgram(program);
bgfx::destroyUniform(u_time);

View File

@ -174,7 +174,12 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::setViewName(8, "Blur vertical");
bgfx::setViewName(9, "Blur horizontal + tonemap");
bgfx::TextureHandle uffizi = loadTexture("uffizi.dds", BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP);
bgfx::TextureHandle uffizi = loadTexture("uffizi.dds"
, 0
| BGFX_TEXTURE_U_CLAMP
| BGFX_TEXTURE_V_CLAMP
| BGFX_TEXTURE_W_CLAMP
);
bgfx::ProgramHandle skyProgram = loadProgram("vs_hdr_skybox", "fs_hdr_skybox");
bgfx::ProgramHandle lumProgram = loadProgram("vs_hdr_lum", "fs_hdr_lum");
@ -371,6 +376,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Render skybox into view 0.
bgfx::setTexture(0, u_texCube, uffizi);
bgfx::setProgram(skyProgram);
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
screenSpaceQuad( (float)width, (float)height, true);

View File

@ -20,7 +20,7 @@ KnightPos knightTour[8*4] =
{0,0}, {1,2}, {3,3}, {4,1}, {5,3}, {7,2}, {6,0}, {5,2},
{7,3}, {6,1}, {4,0}, {3,2}, {2,0}, {0,1}, {1,3}, {2,1},
{0,2}, {1,0}, {2,2}, {0,3}, {1,1}, {3,0}, {4,2}, {5,0},
{7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3}
{7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3},
};
int _main_(int /*_argc*/, char** /*_argv*/)
@ -55,15 +55,19 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::TextureHandle textureStipple;
const bgfx::Memory* stipple = bgfx::alloc(8*4);
memset(stipple->data, 0, stipple->size);
const bgfx::Memory* stippleTex = bgfx::alloc(8*4);
memset(stippleTex->data, 0, stippleTex->size);
for (uint32_t ii = 0; ii < 32; ++ii)
{
stipple->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
stippleTex->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
}
textureStipple = bgfx::createTexture2D(8, 4, 1, bgfx::TextureFormat::R8, BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT, stipple);
textureStipple = bgfx::createTexture2D(8, 4, 1
, bgfx::TextureFormat::R8
, BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT
, stippleTex
);
Mesh* meshTop[3] =
{

View File

@ -1040,9 +1040,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
const float radius = (scene == StencilReflectionScene) ? 15.0f : 25.0f;
for (uint8_t ii = 0; ii < numLights; ++ii)
{
lightPosRadius[ii][0] = sin( (lightTimeAccumulator*1.1f + ii*0.03f + ii*bx::piHalf*1.07f ) )*20.0f;
lightPosRadius[ii][1] = 8.0f + (1.0f - cos( (lightTimeAccumulator*1.5f + ii*0.29f + bx::piHalf*1.49f ) ))*4.0f;
lightPosRadius[ii][2] = cos( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::piHalf*1.79f ) )*20.0f;
lightPosRadius[ii][0] = sinf( (lightTimeAccumulator*1.1f + ii*0.03f + ii*bx::piHalf*1.07f ) )*20.0f;
lightPosRadius[ii][1] = 8.0f + (1.0f - cosf( (lightTimeAccumulator*1.5f + ii*0.29f + bx::piHalf*1.49f ) ))*4.0f;
lightPosRadius[ii][2] = cosf( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::piHalf*1.79f ) )*20.0f;
lightPosRadius[ii][3] = radius;
}
memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float));
@ -1112,9 +1112,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, 0.0f
, 0.0f
, 0.0f
, sin(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
, sinf(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
, 4.0f
, cos(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
, cosf(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f
);
}
@ -1188,7 +1188,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Set lights back.
memcpy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float));
// Third pass - Blend plane.
// Floor.
@ -1217,6 +1216,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, s_renderStates[RenderState::StencilReflection_DrawScene]
);
}
}
break;
@ -1319,10 +1319,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
);
// Cubes.
for (uint8_t ii = 0; ii < numCubes; ++ii)
for (uint8_t jj = 0; jj < numCubes; ++jj)
{
cubeMesh.submit(viewId
, cubeMtx[ii]
, cubeMtx[jj]
, programTextureLightning
, s_renderStates[RenderState::ProjectionShadows_DrawDiffuse]
, figureTex

View File

@ -2276,9 +2276,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
{
lightPosRadius[ii][0] = cos(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][0] = cosf(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][1] = 20.0f;
lightPosRadius[ii][2] = sin(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][2] = sinf(2.0f*bx::pi/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
lightPosRadius[ii][3] = 20.0f;
}
}
@ -2286,9 +2286,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
{
lightPosRadius[ii][0] = cos(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][0] = cosf(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][1] = 20.0f;
lightPosRadius[ii][2] = sin(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][2] = sinf(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + bx::pi) * 40.0f;
lightPosRadius[ii][3] = 20.0f;
}
}
@ -2362,9 +2362,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
inst.m_rotation[0] = 0.0f;
inst.m_rotation[1] = 0.0f;
inst.m_rotation[2] = 0.0f;
inst.m_pos[0] = sin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[0] = sinf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[1] = 6.0f;
inst.m_pos[2] = cos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[2] = cosf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_model = &cubeModel;
}
@ -2379,9 +2379,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
inst.m_rotation[0] = 0.0f;
inst.m_rotation[1] = 0.0f;
inst.m_rotation[2] = 0.0f;
inst.m_pos[0] = sin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[0] = sinf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[1] = 22.0f;
inst.m_pos[2] = cos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_pos[2] = cosf(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f;
inst.m_model = &cubeModel;
}

View File

@ -221,9 +221,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Setup lights.
float lightPos[4];
lightPos[0] = -cos(timeAccumulatorLight);
lightPos[0] = -cosf(timeAccumulatorLight);
lightPos[1] = -1.0f;
lightPos[2] = -sin(timeAccumulatorLight);
lightPos[2] = -sinf(timeAccumulatorLight);
lightPos[3] = 0.0f;
bgfx::setUniform(u_lightPos, lightPos);

View File

@ -2165,16 +2165,16 @@ int _main_(int /*_argc*/, char** /*_argv*/)
if (settings.m_updateScene) { timeAccumulatorScene += deltaTime; }
// Setup lights.
pointLight.m_position.m_x = cos(timeAccumulatorLight) * 20.0f;
pointLight.m_position.m_x = cosf(timeAccumulatorLight) * 20.0f;
pointLight.m_position.m_y = 26.0f;
pointLight.m_position.m_z = sin(timeAccumulatorLight) * 20.0f;
pointLight.m_position.m_z = sinf(timeAccumulatorLight) * 20.0f;
pointLight.m_spotDirectionInner.m_x = -pointLight.m_position.m_x;
pointLight.m_spotDirectionInner.m_y = -pointLight.m_position.m_y;
pointLight.m_spotDirectionInner.m_z = -pointLight.m_position.m_z;
directionalLight.m_position.m_x = -cos(timeAccumulatorLight);
directionalLight.m_position.m_x = -cosf(timeAccumulatorLight);
directionalLight.m_position.m_y = -1.0f;
directionalLight.m_position.m_z = -sin(timeAccumulatorLight);
directionalLight.m_position.m_z = -sinf(timeAccumulatorLight);
// Setup instance matrices.
float mtxFloor[16];

View File

@ -1109,6 +1109,7 @@ BND_EXPORT NVGcolor bndNodeWireColor(const BNDnodeTheme *theme, BNDwidgetState s
#pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings
#pragma warning (disable: 4244)
#pragma warning (disable: 4305)
#pragma warning (disable: 4838) // warning C4838: conversion from 'double' to 'float' requires a narrowing conversion
#ifdef __cplusplus
#define BND_INLINE inline
#else

View File

@ -387,7 +387,7 @@ void drawEyes(struct NVGcontext* vg, float x, float y, float w, float h, float m
float ry = y + ey;
float dx,dy,d;
float br = (ex < ey ? ex : ey) * 0.5f;
float blink = 1 - pow(sinf(t*0.5f),200)*0.8f;
float blink = 1 - powf(sinf(t*0.5f),200)*0.8f;
bg = nvgLinearGradient(vg, x,y+h*0.5f,x+w*0.1f,y+h, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,16));
nvgBeginPath(vg);
@ -1042,10 +1042,10 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h
for (j = 0; j < nglyphs; j++) {
float x0 = glyphs[j].x;
float x1 = (j+1 < nglyphs) ? glyphs[j+1].x : x+row->width;
float gx = x0 * 0.3f + x1 * 0.7f;
if (mx >= px && mx < gx)
float tgx = x0 * 0.3f + x1 * 0.7f;
if (mx >= px && mx < tgx)
caretx = glyphs[j].x;
px = gx;
px = tgx;
}
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(255,192,0,255));
@ -1075,11 +1075,11 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(255,192,0,255));
nvgRoundedRect(vg
, round(bounds[0])-4.0f
, round(bounds[1])-2.0f
, round(bounds[2]-bounds[0])+8.0f
, round(bounds[3]-bounds[1])+4.0f
, (round(bounds[3]-bounds[1])+4.0f)/2.0f-1.0f
, roundf(bounds[0])-4.0f
, roundf(bounds[1])-2.0f
, roundf(bounds[2]-bounds[0])+8.0f
, roundf(bounds[3]-bounds[1])+4.0f
, (roundf(bounds[3]-bounds[1])+4.0f)/2.0f-1.0f
);
nvgFill(vg);
@ -1097,10 +1097,10 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(220,220,220,255));
nvgRoundedRect(vg
, round(bounds[0]-2.0f)
, round(bounds[1]-2.0f)
, round(bounds[2]-bounds[0])+4.0f
, round(bounds[3]-bounds[1])+4.0f
, roundf(bounds[0]-2.0f)
, roundf(bounds[1]-2.0f)
, roundf(bounds[2]-bounds[0])+4.0f
, roundf(bounds[3]-bounds[1])+4.0f
, 3.0f
);
px = float( (int)((bounds[2]+bounds[0])/2) );

View File

@ -529,10 +529,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
Sphere lightPosRadius;
float lightTime = time * lightAnimationSpeed * (sin(light/float(numLights) * bx::piHalf ) * 0.5f + 0.5f);
lightPosRadius.m_center[0] = sin( ( (lightTime + light*0.47f) + bx::piHalf*1.37f ) )*offset;
lightPosRadius.m_center[1] = cos( ( (lightTime + light*0.69f) + bx::piHalf*1.49f ) )*offset;
lightPosRadius.m_center[2] = sin( ( (lightTime + light*0.37f) + bx::piHalf*1.57f ) )*2.0f;
float lightTime = time * lightAnimationSpeed * (sinf(light/float(numLights) * bx::piHalf ) * 0.5f + 0.5f);
lightPosRadius.m_center[0] = sinf( ( (lightTime + light*0.47f) + bx::piHalf*1.37f ) )*offset;
lightPosRadius.m_center[1] = cosf( ( (lightTime + light*0.69f) + bx::piHalf*1.49f ) )*offset;
lightPosRadius.m_center[2] = sinf( ( (lightTime + light*0.37f) + bx::piHalf*1.57f ) )*2.0f;
lightPosRadius.m_radius = 2.0f;
Aabb aabb;

View File

@ -150,8 +150,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// draw moving shape
static float counter = 0.0f;
counter += 0.01f;
float posX = width / 2.0f + sin(counter * 3.18378f) * (width / 2.0f);
float posY = height / 2.0f + cos(counter) * (height / 2.0f);
float posX = width / 2.0f + sinf(counter * 3.18378f) * (width / 2.0f);
float posY = height / 2.0f + cosf(counter) * (height / 2.0f);
vd.drawCircle(posX, posY, 5.0f, 10.0f);
vd.endFrame();

View File

@ -361,10 +361,10 @@ void VectorDisplay::endDraw()
line->y0 = m_pendingPoints[i - 1].y;
line->x1 = m_pendingPoints[i].x;
line->y1 = m_pendingPoints[i].y;
line->a = atan2(line->y1 - line->y0, line->x1 - line->x0); // angle from positive x axis, increasing ccw, [-pi, pi]
line->a = atan2f(line->y1 - line->y0, line->x1 - line->x0); // angle from positive x axis, increasing ccw, [-pi, pi]
line->sin_a = sinf(line->a);
line->cos_a = cosf(line->a);
line->len = sqrt( (line->x1 - line->x0) * (line->x1 - line->x0) + (line->y1 - line->y0) * (line->y1 - line->y0) );
line->len = sqrtf( (line->x1 - line->x0) * (line->x1 - line->x0) + (line->y1 - line->y0) * (line->y1 - line->y0) );
// figure out what connections we have
line->has_prev = (!line->is_first

View File

@ -117,211 +117,238 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, 0
);
// Imgui.
imguiCreate();
const bgfx::Caps* caps = bgfx::getCaps();
const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE);
bgfx::VertexDecl quadVertexDecl;
quadVertexDecl.begin()
.add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float)
.end();
// Create static vertex buffer.
bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) )
, quadVertexDecl
);
// Create static index buffer.
bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_quadIndices, sizeof(s_quadIndices) )
);
// Create particle program from shaders.
bgfx::ProgramHandle particleProgram = loadProgram("vs_particle", "fs_particle");
// Setup compute buffers
bgfx::VertexDecl computeVertexDecl;
computeVertexDecl.begin()
.add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float)
.end();
const uint32_t threadGroupUpdateSize = 512;
const uint32_t maxParticleCount = 32 * 1024;
bgfx::DynamicVertexBufferHandle currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::DynamicVertexBufferHandle currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::DynamicVertexBufferHandle prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::DynamicVertexBufferHandle prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3);
bgfx::ShaderHandle initInstancesShader = loadShader("cs_init_instances");
bgfx::ProgramHandle initInstancesProgram = bgfx::createProgram(initInstancesShader, true);
bgfx::ShaderHandle updateInstancesShader = loadShader("cs_update_instances");
bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true);
u_paramsDataStruct u_paramsData;
InitializeParams(0, &u_paramsData);
bgfx::setUniform(u_params, &u_paramsData, 3);
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
float view[16];
float initialPos[3] = { 0.0f, 0.0f, -45.0f };
cameraCreate();
cameraSetPosition(initialPos);
cameraSetVerticalAngle(0.0f);
cameraGetViewMtx(view);
int32_t scrollArea = 0;
entry::MouseState mouseState;
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
if (computeSupported)
{
int64_t now = bx::getHPCounter();
static int64_t last = now;
const int64_t frameTime = now - last;
last = now;
const double freq = double(bx::getHPFrequency() );
const float deltaTime = float(frameTime/freq);
// Imgui.
imguiCreate();
// Set view 0 default viewport.
bgfx::setViewRect(0, 0, 0, width, height);
bgfx::VertexDecl quadVertexDecl;
quadVertexDecl.begin()
.add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float)
.end();
// Use debug font to print information about this example.
bgfx::dbgTextClear();
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
// Create static vertex buffer.
bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) )
, quadVertexDecl
);
imguiBeginFrame(mouseState.m_mx
, mouseState.m_my
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
, 0
, width
, height
);
imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea);
imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100);
int32_t shape = imguiChoose(u_paramsData.initialShape, "Point", "Sphere", "Box", "Donut");
imguiSlider("Initial speed", u_paramsData.initialSpeed, 0.0f, 300.0f, 0.1f);
bool reset = imguiButton("Reset");
imguiSeparatorLine();
imguiSlider("Particle count (x512)", u_paramsData.dispatchSize, 1, 64);
imguiSlider("Gravity", u_paramsData.gravity, 0.0f, 0.3f, 0.001f);
imguiSlider("Damping", u_paramsData.damping, 0.0f, 1.0f, 0.01f);
imguiSlider("Max acceleration", u_paramsData.maxAccel, 0.0f, 100.0f, 0.01f);
imguiSlider("Time step", u_paramsData.timeStep, 0.0f, 0.02f, 0.0001f);
imguiSeparatorLine();
imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f);
imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f);
imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f);
imguiEndScrollArea();
imguiEndFrame();
// Create static index buffer.
bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_quadIndices, sizeof(s_quadIndices) )
);
// Modify parameters and reset if shape is changed
if (shape != u_paramsData.initialShape)
{
reset = true;
InitializeParams(shape, &u_paramsData);
}
// Create particle program from shaders.
bgfx::ProgramHandle particleProgram = loadProgram("vs_particle", "fs_particle");
if (reset)
{
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
bgfx::setUniform(u_params, &u_paramsData, 3);
bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
}
// Setup compute buffers
bgfx::VertexDecl computeVertexDecl;
computeVertexDecl.begin()
.add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float)
.end();
const uint32_t threadGroupUpdateSize = 512;
const uint32_t maxParticleCount = 32 * 1024;
bgfx::DynamicVertexBufferHandle currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::DynamicVertexBufferHandle currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::DynamicVertexBufferHandle prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::DynamicVertexBufferHandle prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE);
bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3);
bgfx::ShaderHandle initInstancesShader = loadShader("cs_init_instances");
bgfx::ProgramHandle initInstancesProgram = bgfx::createProgram(initInstancesShader, true);
bgfx::ShaderHandle updateInstancesShader = loadShader("cs_update_instances");
bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true);
u_paramsDataStruct u_paramsData;
InitializeParams(0, &u_paramsData);
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read);
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read);
bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write);
bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write);
bgfx::setUniform(u_params, &u_paramsData, 3);
bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1);
bx::xchg(currPositionBuffer0, currPositionBuffer1);
bx::xchg(prevPositionBuffer0, prevPositionBuffer1);
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
float view[16];
// Update camera.
cameraUpdate(deltaTime, mouseState);
float initialPos[3] = { 0.0f, 0.0f, -45.0f };
cameraCreate();
cameraSetPosition(initialPos);
cameraSetVerticalAngle(0.0f);
cameraGetViewMtx(view);
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd)
int32_t scrollArea = 0;
entry::MouseState mouseState;
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
{
float viewHead[16];
float eye[3] = {};
bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye);
float tmp[16];
bx::mtxMul(tmp, view, viewHead);
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f);
bgfx::setViewTransform(0, tmp, proj);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float proj[16];
bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f);
bgfx::setViewTransform(0, view, proj);
int64_t now = bx::getHPCounter();
static int64_t last = now;
const int64_t frameTime = now - last;
last = now;
const double freq = double(bx::getHPFrequency() );
const float deltaTime = float(frameTime/freq);
// Set view 0 default viewport.
bgfx::setViewRect(0, 0, 0, width, height);
// Use debug font to print information about this example.
bgfx::dbgTextClear();
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
imguiBeginFrame(mouseState.m_mx
, mouseState.m_my
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
, 0
, width
, height
);
imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea);
imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100);
int32_t shape = imguiChoose(u_paramsData.initialShape, "Point", "Sphere", "Box", "Donut");
imguiSlider("Initial speed", u_paramsData.initialSpeed, 0.0f, 300.0f, 0.1f);
bool defaults = imguiButton("Reset");
imguiSeparatorLine();
imguiSlider("Particle count (x512)", u_paramsData.dispatchSize, 1, 64);
imguiSlider("Gravity", u_paramsData.gravity, 0.0f, 0.3f, 0.001f);
imguiSlider("Damping", u_paramsData.damping, 0.0f, 1.0f, 0.01f);
imguiSlider("Max acceleration", u_paramsData.maxAccel, 0.0f, 100.0f, 0.01f);
imguiSlider("Time step", u_paramsData.timeStep, 0.0f, 0.02f, 0.0001f);
imguiSeparatorLine();
imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f);
imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f);
imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f);
imguiEndScrollArea();
imguiEndFrame();
// Modify parameters and reset if shape is changed
if (shape != u_paramsData.initialShape)
{
defaults = true;
InitializeParams(shape, &u_paramsData);
}
if (defaults)
{
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write);
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write);
bgfx::setUniform(u_params, &u_paramsData, 3);
bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
}
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read);
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read);
bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write);
bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write);
bgfx::setUniform(u_params, &u_paramsData, 3);
bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1);
bx::xchg(currPositionBuffer0, currPositionBuffer1);
bx::xchg(prevPositionBuffer0, prevPositionBuffer1);
// Update camera.
cameraUpdate(deltaTime, mouseState);
cameraGetViewMtx(view);
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd)
{
float viewHead[16];
float eye[3] = {};
bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye);
float tmp[16];
bx::mtxMul(tmp, view, viewHead);
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f);
bgfx::setViewTransform(0, tmp, proj);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float proj[16];
bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f);
bgfx::setViewTransform(0, view, proj);
// Set view 0 default viewport.
bgfx::setViewRect(0, 0, 0, width, height);
}
// Set vertex and fragment shaders.
bgfx::setProgram(particleProgram);
// Set vertex and index buffer.
bgfx::setVertexBuffer(vbh);
bgfx::setIndexBuffer(ibh);
bgfx::setInstanceDataBuffer(currPositionBuffer0, 0, u_paramsData.dispatchSize * threadGroupUpdateSize);
// Set render states.
bgfx::setState(0
| BGFX_STATE_RGB_WRITE
| BGFX_STATE_BLEND_ADD
| BGFX_STATE_DEPTH_TEST_ALWAYS
);
// Submit primitive for rendering to view 0.
bgfx::submit(0);
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
}
// Set vertex and fragment shaders.
bgfx::setProgram(particleProgram);
// Set vertex and index buffer.
bgfx::setVertexBuffer(vbh);
bgfx::setIndexBuffer(ibh);
bgfx::setInstanceDataBuffer(currPositionBuffer0, 0, u_paramsData.dispatchSize * threadGroupUpdateSize);
// Set render states.
bgfx::setState(0
| BGFX_STATE_RGB_WRITE
| BGFX_STATE_BLEND_ADD
| BGFX_STATE_DEPTH_TEST_ALWAYS
);
// Submit primitive for rendering to view 0.
bgfx::submit(0);
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
// Cleanup.
cameraDestroy();
imguiDestroy();
bgfx::destroyUniform(u_params);
bgfx::destroyDynamicVertexBuffer(currPositionBuffer0);
bgfx::destroyDynamicVertexBuffer(currPositionBuffer1);
bgfx::destroyDynamicVertexBuffer(prevPositionBuffer0);
bgfx::destroyDynamicVertexBuffer(prevPositionBuffer1);
bgfx::destroyProgram(updateInstancesProgram);
bgfx::destroyProgram(initInstancesProgram);
bgfx::destroyIndexBuffer(ibh);
bgfx::destroyVertexBuffer(vbh);
bgfx::destroyProgram(particleProgram);
}
else
{
int64_t timeOffset = bx::getHPCounter();
// Cleanup.
cameraDestroy();
imguiDestroy();
bgfx::destroyUniform(u_params);
bgfx::destroyDynamicVertexBuffer(currPositionBuffer0);
bgfx::destroyDynamicVertexBuffer(currPositionBuffer1);
bgfx::destroyDynamicVertexBuffer(prevPositionBuffer0);
bgfx::destroyDynamicVertexBuffer(prevPositionBuffer1);
bgfx::destroyProgram(updateInstancesProgram);
bgfx::destroyProgram(initInstancesProgram);
bgfx::destroyIndexBuffer(ibh);
bgfx::destroyVertexBuffer(vbh);
bgfx::destroyProgram(particleProgram);
entry::MouseState mouseState;
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
{
int64_t now = bx::getHPCounter();
float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) );
bgfx::setViewRect(0, 0, 0, width, height);
bgfx::dbgTextClear();
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody");
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers.");
bool blink = uint32_t(time*3.0f)&1;
bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " Compute is not supported by GPU. ");
bgfx::submit(0);
bgfx::frame();
}
}
// Shutdown bgfx.
bgfx::shutdown();

View File

@ -15,14 +15,19 @@ uint16_t uint16_max(uint16_t _a, uint16_t _b)
int _main_(int _argc, char** _argv)
{
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
(void)_argc;
(void)_argv;
uint32_t width = 1280;
uint32_t height = 720;
uint32_t debug = BGFX_DEBUG_TEXT;
uint32_t reset = BGFX_RESET_VSYNC;
bgfx_init(BGFX_RENDERER_TYPE_COUNT, NULL, NULL);
bgfx_init(BGFX_RENDERER_TYPE_COUNT
, BGFX_PCI_ID_NONE
, 0
, NULL
, NULL
);
bgfx_reset(width, height, reset);
// Enable debug text.

View File

@ -264,9 +264,9 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num
{
position = (float*)&vertex[index*_stride];
float xx = position[0] - center[0];
float yy = position[1] - center[1];
float zz = position[2] - center[2];
xx = position[0] - center[0];
yy = position[1] - center[1];
zz = position[2] - center[2];
float distSq = xx*xx + yy*yy + zz*zz;
if (distSq > maxDistSq)

View File

@ -29,8 +29,11 @@ namespace entry
#if ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
bx::ReallocatorI* getDefaultAllocator()
{
BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC();
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4459); // warning C4459: declaration of 's_allocator' hides global declaration
static bx::CrtAllocator s_allocator;
return &s_allocator;
BX_PRAGMA_DIAGNOSTIC_POP_MSVC();
}
#endif // ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR

View File

@ -0,0 +1,139 @@
/*
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "entry_p.h"
#if ENTRY_CONFIG_USE_GLFW
#define GLFW_DLL
#include <GLFW/glfw3.h>
#include <bgfxplatform.h>
#include "dbg.h"
// This is just trivial implementation of GLFW3 integration.
// It's here just for testing purpose.
namespace entry
{
static void errorCb(int _error, const char* _description)
{
DBG("GLFW error %d: %s", _error, _description);
}
struct Context
{
Context()
{
}
int run(int _argc, char** _argv)
{
glfwSetErrorCallback(errorCb);
glfwInit();
m_window = glfwCreateWindow(1280, 720, "bgfx", NULL, NULL);
glfwMakeContextCurrent(m_window);
glfwSetKeyCallback(m_window, keyCb);
bgfx::glfwSetWindow(m_window);
int result = main(_argc, _argv);
glfwDestroyWindow(m_window);
glfwTerminate();
return result;
}
static void keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods);
EventQueue m_eventQueue;
GLFWwindow* m_window;
};
Context s_ctx;
void Context::keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods)
{
BX_UNUSED(_window, _scancode, _mods);
if (_key == GLFW_KEY_Q
&& _action == GLFW_PRESS
&& _mods == GLFW_MOD_CONTROL)
{
s_ctx.m_eventQueue.postExitEvent();
}
}
const Event* poll()
{
glfwPollEvents();
if (glfwWindowShouldClose(s_ctx.m_window) )
{
s_ctx.m_eventQueue.postExitEvent();
}
return s_ctx.m_eventQueue.poll();
}
const Event* poll(WindowHandle _handle)
{
return s_ctx.m_eventQueue.poll(_handle);
}
void release(const Event* _event)
{
s_ctx.m_eventQueue.release(_event);
}
WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title)
{
BX_UNUSED(_x, _y, _width, _height, _flags, _title);
WindowHandle handle = { UINT16_MAX };
return handle;
}
void destroyWindow(WindowHandle _handle)
{
BX_UNUSED(_handle);
}
void setWindowPos(WindowHandle _handle, int32_t _x, int32_t _y)
{
BX_UNUSED(_handle, _x, _y);
}
void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height)
{
BX_UNUSED(_handle, _width, _height);
}
void setWindowTitle(WindowHandle _handle, const char* _title)
{
BX_UNUSED(_handle, _title);
}
void toggleWindowFrame(WindowHandle _handle)
{
BX_UNUSED(_handle);
}
void toggleFullscreen(WindowHandle _handle)
{
BX_UNUSED(_handle);
}
void setMouseLock(WindowHandle _handle, bool _lock)
{
BX_UNUSED(_handle, _lock);
}
}
int main(int _argc, char** _argv)
{
using namespace entry;
return s_ctx.run(_argc, _argv);
}
#endif // ENTRY_CONFIG_USE_GLFW

View File

@ -311,19 +311,9 @@ namespace entry
else
{
enum { ShiftMask = Modifier::LeftShift|Modifier::RightShift };
const bool nonShiftModifiers = (0 != (modifiers&(~ShiftMask) ) );
const bool isCharPressed = (Key::Key0 <= key && key <= Key::KeyZ) || (Key::Esc <= key && key <= Key::Minus);
const bool isText = isCharPressed && !nonShiftModifiers;
if (isText)
{
m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar);
return false;
}
else
{
m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true);
return false;
}
m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar);
m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true);
return false;
}
}

View File

@ -17,8 +17,13 @@
# define ENTRY_CONFIG_USE_SDL 0
#endif // ENTRY_CONFIG_USE_SDL
#if !ENTRY_CONFIG_USE_SDL && \
!defined(ENTRY_CONFIG_USE_NATIVE)
#ifndef ENTRY_CONFIG_USE_GLFW
# define ENTRY_CONFIG_USE_GLFW 0
#endif // ENTRY_CONFIG_USE_GLFW
#if !defined(ENTRY_CONFIG_USE_NATIVE) \
&& !ENTRY_CONFIG_USE_SDL \
&& !ENTRY_CONFIG_USE_GLFW
# define ENTRY_CONFIG_USE_NATIVE 1
#else
# define ENTRY_CONFIG_USE_NATIVE 0
@ -156,6 +161,14 @@ namespace entry
class EventQueue
{
public:
~EventQueue()
{
for (const Event* ev = poll(); NULL != ev; ev = poll() )
{
release(ev);
}
}
void postAxisEvent(WindowHandle _handle, GamepadHandle _gamepad, GamepadAxis::Enum _axis, int32_t _value)
{
AxisEvent* ev = new AxisEvent(_handle);

View File

@ -412,7 +412,7 @@ NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u)
{
cint.rgba[i] = c0.rgba[i] * oneminu + c1.rgba[i] * u;
}
return cint;
}
@ -934,7 +934,7 @@ void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h)
}
// Transform the current scissor rect into current transform space.
// If there is difference in rotation, this will be approximation.
// If there is difference in rotation, this will be approximation.
memcpy(pxform, state->scissor.xform, sizeof(float)*6);
ex = state->scissor.extent[0];
ey = state->scissor.extent[1];
@ -1194,7 +1194,7 @@ static void nvg__tesselateBezier(NVGcontext* ctx,
{
float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234;
float dx,dy,d2,d3;
if (level > 10) return;
x12 = (x1+x2)*0.5f;
@ -1226,8 +1226,8 @@ static void nvg__tesselateBezier(NVGcontext* ctx,
x1234 = (x123+x234)*0.5f;
y1234 = (y123+y234)*0.5f;
nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
}
static void nvg__flattenPaths(NVGcontext* ctx)
@ -1625,7 +1625,7 @@ static void nvg__calculateJoins(NVGcontext* ctx, float w, int lineJoin, float mi
static int nvg__expandStroke(NVGcontext* ctx, float w, int lineCap, int lineJoin, float miterLimit)
{
{
NVGpathCache* cache = ctx->cache;
NVGvertex* verts;
NVGvertex* dst;
@ -1889,7 +1889,7 @@ void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y)
{
float x0 = ctx->commandx;
float y0 = ctx->commandy;
float vals[] = { NVG_BEZIERTO,
float vals[] = { NVG_BEZIERTO,
x0 + 2.0f/3.0f*(cx - x0), y0 + 2.0f/3.0f*(cy - y0),
x + 2.0f/3.0f*(cx - x), y + 2.0f/3.0f*(cy - y),
x, y };
@ -1971,7 +1971,7 @@ void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, in
float px = 0, py = 0, ptanx = 0, ptany = 0;
float vals[3 + 5*7 + 100];
int i, ndivs, nvals;
int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
// Clamp angles
da = a1 - a0;
@ -2364,7 +2364,7 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char*
}
}
// TODO: add back-end bit to do this just once per frame.
// TODO: add back-end bit to do this just once per frame.
nvg__flushTextTexture(ctx);
nvg__renderText(ctx, verts, nverts);

View File

@ -1,3 +1,4 @@
*.dll
*.so
*.pdb
imgui*

View File

@ -272,6 +272,15 @@ typedef struct bgfx_texture_info
} bgfx_texture_info_t;
/**
*/
typedef struct bgfx_caps_gpu
{
uint16_t vendorId;
uint16_t deviceId;
} bgfx_caps_gpu_t;
/**
* Renderer capabilities.
*/
@ -293,6 +302,11 @@ typedef struct bgfx_caps
uint16_t maxViews; /* < Maximum views. */
uint16_t maxDrawCalls; /* < Maximum draw calls. */
uint8_t maxFBAttachments; /* < Maximum frame buffer attachments. */
uint8_t numGPUs; /* < */
uint16_t vendorId; /* < */
uint16_t deviceId; /* < */
bgfx_caps_gpu_t gpu[4]; /* < */
/**
* Supported texture formats.
@ -559,7 +573,7 @@ BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type);
* specified, library uses default CRT allocator. The library assumes
* custom allocator is thread safe.
*/
BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, bgfx_callback_interface_t* _callback, bgfx_reallocator_interface_t* _allocator);
BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_reallocator_interface_t* _allocator);
/**
* Shutdown bgfx library.

View File

@ -315,6 +315,18 @@ namespace bgfx
uint16_t maxViews; ///< Maximum views.
uint16_t maxDrawCalls; ///< Maximum draw calls.
uint8_t maxFBAttachments; ///< Maximum frame buffer attachments.
uint8_t numGPUs; ///<
uint16_t vendorId; ///<
uint16_t deviceId; ///<
struct GPU
{
uint16_t vendorId;
uint16_t deviceId;
};
GPU gpu[4]; ///<
/// Supported texture formats.
/// - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - not supported
@ -508,6 +520,15 @@ namespace bgfx
/// default rendering backend will be selected.
/// See: `bgfx::RendererType`
///
/// @param _vendorId Vendor PCI id. If set to BGFX_PCI_ID_NONE it will select the first device.
/// - `BGFX_PCI_ID_NONE` - autoselect.
/// - `BGFX_PCI_ID_AMD` - AMD.
/// - `BGFX_PCI_ID_INTEL` - Intel.
/// - `BGFX_PCI_ID_NVIDIA` - nVidia.
///
/// @param _deviceId Device id. If set to 0 it will select first device, or device with
/// matching id.
///
/// @param _callback Provide application specific callback interface.
/// See: `bgfx::CallbackI`
///
@ -517,7 +538,7 @@ namespace bgfx
///
/// @attention C99 equivalent is `bgfx_init`.
///
void init(RendererType::Enum _type = RendererType::Count, CallbackI* _callback = NULL, bx::ReallocatorI* _reallocator = NULL);
void init(RendererType::Enum _type = RendererType::Count, uint16_t _vendorId = BGFX_PCI_ID_NONE, uint16_t _deviceId = 0, CallbackI* _callback = NULL, bx::ReallocatorI* _reallocator = NULL);
/// Shutdown bgfx library.
///

View File

@ -81,16 +81,16 @@
| BGFX_STATE_MSAA \
)
#define BGFX_STATE_ALPHA_REF(_ref) ( (uint64_t(_ref)<<BGFX_STATE_ALPHA_REF_SHIFT)&BGFX_STATE_ALPHA_REF_MASK)
#define BGFX_STATE_POINT_SIZE(_size) ( (uint64_t(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
#define BGFX_STATE_ALPHA_REF(_ref) ( ( (uint64_t)(_ref )<<BGFX_STATE_ALPHA_REF_SHIFT )&BGFX_STATE_ALPHA_REF_MASK)
#define BGFX_STATE_POINT_SIZE(_size) ( ( (uint64_t)(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
///
#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (0 \
| ( (uint64_t(_srcRGB)|(uint64_t(_dstRGB)<<4) ) ) \
| ( (uint64_t(_srcA )|(uint64_t(_dstA )<<4) )<<8) \
#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (UINT64_C(0) \
| ( ( (uint64_t)(_srcRGB)|( (uint64_t)(_dstRGB)<<4) ) ) \
| ( ( (uint64_t)(_srcA )|( (uint64_t)(_dstA )<<4) )<<8) \
)
#define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) (uint64_t(_rgb)|(uint64_t(_a)<<3) )
#define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) ( (uint64_t)(_rgb)|( (uint64_t)(_a)<<3) )
///
#define BGFX_STATE_BLEND_FUNC(_src, _dst) BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst)
@ -333,4 +333,10 @@
#define BGFX_SUBMIT_EYE_MASK UINT8_C(0x03)
#define BGFX_SUBMIT_EYE_FIRST BGFX_SUBMIT_EYE_LEFT
///
#define BGFX_PCI_ID_NONE UINT16_C(0x0000)
#define BGFX_PCI_ID_AMD UINT16_C(0x1002)
#define BGFX_PCI_ID_INTEL UINT16_C(0x8086)
#define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de)
#endif // BGFX_DEFINES_H_HEADER_GUARD

View File

@ -55,7 +55,7 @@ namespace bgfx
namespace bgfx
{
///
void x11SetDisplayWindow(void* _display, uint32_t _window);
void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL);
} // namespace bgfx
@ -76,7 +76,7 @@ namespace bgfx
namespace bgfx
{
///
void osxSetNSWindow(void* _window);
void osxSetNSWindow(void* _window, void* _nsgl = NULL);
} // namespace bgfx
@ -155,15 +155,17 @@ namespace bgfx
{
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
::Display* display = glfwGetX11Display();
::Window window = glfwGetX11Window(_window);
x11SetDisplayWindow(display, window);
::Window window = glfwGetX11Window(_window);
void* glx = glfwGetGLXContext(_window);
x11SetDisplayWindow(display, window, glx);
# elif BX_PLATFORM_OSX
void* id = glfwGetCocoaWindow(_window);
osxSetNSWindow(id);
void* window = glfwGetCocoaWindow(_window);
void* nsgl = glfwGetNSGLContext(_window);
osxSetNSWindow(window, nsgl);
# elif BX_PLATFORM_WINDOWS
HWND hwnd = glfwGetWin32Window(_window);
winSetHwnd(hwnd);
# endif BX_PLATFORM_WINDOWS
# endif // BX_PLATFORM_WINDOWS
}
} // namespace bgfx

View File

@ -217,12 +217,14 @@ OS=darwin
BUILD_PROJECT_DIR=gmake-osx
BUILD_OUTPUT_DIR=osx64_clang
BUILD_TOOLS_CONFIG=release64
BUILD_TOOLS_SUFFIX=Release
EXE=
else
OS=linux
BUILD_PROJECT_DIR=gmake-linux
BUILD_OUTPUT_DIR=linux64_gcc
BUILD_TOOLS_CONFIG=release64
BUILD_TOOLS_SUFFIX=Release
EXE=
endif
else
@ -230,19 +232,16 @@ OS=windows
BUILD_PROJECT_DIR=gmake-mingw-gcc
BUILD_OUTPUT_DIR=win32_mingw-gcc
BUILD_TOOLS_CONFIG=release32
BUILD_TOOLS_SUFFIX=Release
EXE=.exe
endif
.build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
$(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
tools/bin/$(OS)/shaderc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE)
$(SILENT) cp $(<) $(@)
.build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG)
tools/bin/$(OS)/geometryc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE)
$(SILENT) cp $(<) $(@)
$(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE)

View File

@ -26,7 +26,7 @@ function bgfxProject(_name, _kind, _defines)
}
configuration { "linux-*" }
buildoptions {
buildoptions {
"-fPIC",
}
@ -42,6 +42,12 @@ function bgfxProject(_name, _kind, _defines)
_defines,
}
if _OPTIONS["with-glfw"] then
defines {
"BGFX_CONFIG_MULTITHREADED=0",
}
end
if _OPTIONS["with-ovr"] then
defines {
"BGFX_CONFIG_USE_OVR=1",
@ -113,10 +119,34 @@ function bgfxProject(_name, _kind, _defines)
path.join(BGFX_DIR, "src/**.h"),
}
excludes {
removefiles {
path.join(BGFX_DIR, "src/**.bin.h"),
}
if _OPTIONS["with-amalgamated"] then
excludes {
path.join(BGFX_DIR, "src/bgfx.cpp"),
path.join(BGFX_DIR, "src/glcontext_egl.cpp"),
path.join(BGFX_DIR, "src/glcontext_glx.cpp"),
path.join(BGFX_DIR, "src/glcontext_ppapi.cpp"),
path.join(BGFX_DIR, "src/glcontext_wgl.cpp"),
path.join(BGFX_DIR, "src/image.cpp"),
path.join(BGFX_DIR, "src/ovr.cpp"),
path.join(BGFX_DIR, "src/renderdoc.cpp"),
path.join(BGFX_DIR, "src/renderer_d3d9.cpp"),
path.join(BGFX_DIR, "src/renderer_d3d11.cpp"),
path.join(BGFX_DIR, "src/renderer_d3d12.cpp"),
path.join(BGFX_DIR, "src/renderer_null.cpp"),
path.join(BGFX_DIR, "src/renderer_gl.cpp"),
path.join(BGFX_DIR, "src/renderer_vk.cpp"),
path.join(BGFX_DIR, "src/vertexdecl.cpp"),
}
else
excludes {
path.join(BGFX_DIR, "src/amalgamated.cpp"),
}
end
configuration {}
copyLib()

View File

@ -31,6 +31,12 @@ project ("example-common")
}
end
if _OPTIONS["with-glfw"] then
defines {
"ENTRY_CONFIG_USE_GLFW=1",
}
end
configuration { "mingw* or vs2008" }
includedirs {
"$(DXSDK_DIR)/include",

View File

@ -4,13 +4,13 @@
--
newoption {
trigger = "with-tools",
description = "Enable building tools.",
trigger = "with-amalgamated",
description = "Enable amalgamated build.",
}
newoption {
trigger = "with-shared-lib",
description = "Enable building shared library.",
trigger = "with-ovr",
description = "Enable OculusVR integration.",
}
newoption {
@ -19,8 +19,18 @@ newoption {
}
newoption {
trigger = "with-ovr",
description = "Enable OculusVR integration.",
trigger = "with-glfw",
description = "Enable GLFW entry.",
}
newoption {
trigger = "with-shared-lib",
description = "Enable building shared library.",
}
newoption {
trigger = "with-tools",
description = "Enable building tools.",
}
solution "bgfx"
@ -32,14 +42,14 @@ solution "bgfx"
if _ACTION == "xcode4" then
platforms {
"Universal",
}
}
else
platforms {
"x32",
"x64",
-- "Xbox360",
"Native", -- for targets where bitness is not specified
}
}
end
language "C++"
@ -96,6 +106,10 @@ function exampleProject(_name)
path.join(BGFX_DIR, "examples", _name, "**.h"),
}
removefiles {
path.join(BGFX_DIR, "examples", _name, "**.bin.h"),
}
links {
"bgfx",
"example-common",
@ -114,29 +128,72 @@ function exampleProject(_name)
configuration {}
end
if _OPTIONS["with-glfw"] then
defines { "ENTRY_CONFIG_USE_GLFW=1" }
links {
"glfw3"
}
configuration { "linux" }
links {
"Xrandr",
"Xinerama",
"Xi",
"Xxf86vm",
"Xcursor",
}
configuration { "osx" }
linkoptions {
"-framework CoreVideo",
"-framework IOKit",
}
configuration {}
end
if _OPTIONS["with-ovr"] then
links {
"winmm",
"ws2_32",
}
configuration { "x32" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Win32", _ACTION) }
-- Check for LibOVR 5.0+
if os.isdir(path.join(os.getenv("OVR_DIR"), "LibOVR/Lib/Windows/Win32/Debug/VS2012")) then
configuration { "x64" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/x64", _ACTION) }
configuration { "x32", "Debug" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Debug", _ACTION) }
configuration { "x32", "Debug" }
links { "libovrd" }
configuration { "x32", "Release" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release", _ACTION) }
configuration { "x32", "Release" }
links { "libovr" }
configuration { "x64", "Debug" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Debug", _ACTION) }
configuration { "x64", "Debug" }
links { "libovr64d" }
configuration { "x64", "Release" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Release", _ACTION) }
configuration { "x64", "Release" }
links { "libovr64" }
configuration { "x32 or x64" }
links { "libovr" }
else
configuration { "x32" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Win32", _ACTION) }
configuration { "x64" }
libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/x64", _ACTION) }
configuration { "x32", "Debug" }
links { "libovrd" }
configuration { "x32", "Release" }
links { "libovr" }
configuration { "x64", "Debug" }
links { "libovr64d" }
configuration { "x64", "Release" }
links { "libovr64" }
end
configuration {}
end

20
3rdparty/bgfx/src/amalgamated.cpp vendored Normal file
View File

@ -0,0 +1,20 @@
/*
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "bgfx.cpp"
#include "glcontext_egl.cpp"
#include "glcontext_glx.cpp"
#include "glcontext_ppapi.cpp"
#include "glcontext_wgl.cpp"
#include "image.cpp"
#include "ovr.cpp"
#include "renderdoc.cpp"
#include "renderer_d3d9.cpp"
#include "renderer_d3d11.cpp"
#include "renderer_d3d12.cpp"
#include "renderer_null.cpp"
#include "renderer_gl.cpp"
#include "renderer_vk.cpp"
#include "vertexdecl.cpp"

View File

@ -19,14 +19,6 @@ namespace bgfx
# define BGFX_CHECK_RENDER_THREAD()
#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
#define BGFX_CHECK_HANDLE(_handle, _max) \
BX_CHECK(isValid(_handle) \
&& _handle.idx < _max \
, "Invalid handle. %d (< %d " #_max ")" \
, _handle.idx \
, _max \
);
#if BX_PLATFORM_ANDROID
::ANativeWindow* g_bgfxAndroidWindow = NULL;
@ -44,18 +36,22 @@ namespace bgfx
#elif BX_PLATFORM_LINUX
void* g_bgfxX11Display;
uint32_t g_bgfxX11Window;
void* g_bgfxGLX;
void x11SetDisplayWindow(void* _display, uint32_t _window)
void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx)
{
g_bgfxX11Display = _display;
g_bgfxX11Window = _window;
g_bgfxGLX = _glx;
}
#elif BX_PLATFORM_OSX
void* g_bgfxNSWindow = NULL;
void* g_bgfxNSGL = NULL;
void osxSetNSWindow(void* _window)
void osxSetNSWindow(void* _window, void* _nsgl)
{
g_bgfxNSWindow = _window;
g_bgfxNSGL = _nsgl;
}
#elif BX_PLATFORM_WINDOWS
::HWND g_bgfxHwnd = NULL;
@ -892,7 +888,11 @@ namespace bgfx
static void dumpCaps()
{
BX_TRACE("Supported capabilities (%s):", s_ctx->m_renderCtx->getRendererName() );
BX_TRACE("Supported capabilities (renderer %s, vendor 0x%04x, device 0x%04x):"
, s_ctx->m_renderCtx->getRendererName()
, g_caps.vendorId
, g_caps.deviceId
);
for (uint32_t ii = 0; ii < BX_COUNTOF(s_capsFlags); ++ii)
{
if (0 != (g_caps.supported & s_capsFlags[ii].m_flag) )
@ -1332,23 +1332,21 @@ namespace bgfx
typedef RendererContextI* (*RendererCreateFn)();
typedef void (*RendererDestroyFn)();
extern RendererContextI* rendererCreateNULL();
extern void rendererDestroyNULL();
#define BGFX_RENDERER_CONTEXT(_namespace) \
namespace _namespace \
{ \
extern RendererContextI* rendererCreate(); \
extern void rendererDestroy(); \
}
extern RendererContextI* rendererCreateGL();
extern void rendererDestroyGL();
BGFX_RENDERER_CONTEXT(noop);
BGFX_RENDERER_CONTEXT(d3d9);
BGFX_RENDERER_CONTEXT(d3d11);
BGFX_RENDERER_CONTEXT(d3d12);
BGFX_RENDERER_CONTEXT(gl);
BGFX_RENDERER_CONTEXT(vk);
extern RendererContextI* rendererCreateD3D9();
extern void rendererDestroyD3D9();
extern RendererContextI* rendererCreateD3D11();
extern void rendererDestroyD3D11();
extern RendererContextI* rendererCreateD3D12();
extern void rendererDestroyD3D12();
extern RendererContextI* rendererCreateVK();
extern void rendererDestroyVK();
#undef BGFX_RENDERER_CONTEXT
struct RendererCreator
{
@ -1360,13 +1358,13 @@ namespace bgfx
static const RendererCreator s_rendererCreator[] =
{
{ rendererCreateNULL, rendererDestroyNULL, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null
{ rendererCreateD3D9, rendererDestroyD3D9, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9
{ rendererCreateD3D11, rendererDestroyD3D11, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
{ rendererCreateD3D12, rendererDestroyD3D12, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
{ rendererCreateGL, rendererDestroyGL, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES
{ rendererCreateGL, rendererDestroyGL, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL
{ rendererCreateVK, rendererDestroyVK, BGFX_RENDERER_VULKAN_NAME, !!BGFX_CONFIG_RENDERER_VULKAN }, // Vulkan
{ noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null
{ d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9
{ d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
{ d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
{ gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES
{ gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL
{ vk::rendererCreate, vk::rendererDestroy, BGFX_RENDERER_VULKAN_NAME, !!BGFX_CONFIG_RENDERER_VULKAN }, // Vulkan
};
BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count);
@ -1983,7 +1981,7 @@ again:
return s_rendererCreator[_type].name;
}
void init(RendererType::Enum _type, CallbackI* _callback, bx::ReallocatorI* _allocator)
void init(RendererType::Enum _type, uint16_t _vendorId, uint16_t _deviceId, CallbackI* _callback, bx::ReallocatorI* _allocator)
{
BX_CHECK(NULL == s_ctx, "bgfx is already initialized.");
BX_TRACE("Init...");
@ -1995,6 +1993,8 @@ again:
g_caps.maxViews = BGFX_CONFIG_MAX_VIEWS;
g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
g_caps.maxFBAttachments = 1;
g_caps.vendorId = _vendorId;
g_caps.deviceId = _deviceId;
if (NULL != _allocator)
{
@ -2770,21 +2770,18 @@ again:
void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_UNIFORMS);
s_ctx->setUniform(_handle, _value, _num);
}
void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
}
void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
}
@ -2809,14 +2806,12 @@ again:
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
}
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
s_ctx->setVertexBuffer(_handle, _numVertices);
}
@ -2842,21 +2837,18 @@ again:
void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
}
void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
}
void setProgram(ProgramHandle _handle)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_PROGRAMS);
s_ctx->setProgram(_handle);
}
@ -2881,28 +2873,24 @@ again:
void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
@ -3030,9 +3018,11 @@ BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type)
return bgfx::getRendererName(bgfx::RendererType::Enum(_type) );
}
BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, struct bgfx_callback_interface* _callback, struct bgfx_reallocator_interface* _allocator)
BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_reallocator_interface_t* _allocator)
{
return bgfx::init(bgfx::RendererType::Enum(_type)
, _vendorId
, _deviceId
, reinterpret_cast<bgfx::CallbackI*>(_callback)
, reinterpret_cast<bx::ReallocatorI*>(_allocator)
);

View File

@ -29,6 +29,26 @@
#include <string.h>
#include <alloca.h>
// Check handle, cannot be bgfx::invalidHandle and must be valid.
#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \
BX_CHECK(isValid(_handle) \
&& _handleAlloc.isValid(_handle.idx) \
, "Invalid handle. %s handle: %d (max %d)" \
, _desc \
, _handle.idx \
, _handleAlloc.getMaxHandles() \
)
// Check handle, it's ok to be bgfx::invalidHandle or must be valid.
#define BGFX_CHECK_HANDLE_INVALID_OK(_desc, _handleAlloc, _handle) \
BX_CHECK(!isValid(_handle) \
|| _handleAlloc.isValid(_handle.idx) \
, "Invalid handle. %s handle: %d (max %d)" \
, _desc \
, _handle.idx \
, _handleAlloc.getMaxHandles() \
)
namespace bgfx
{
#if BX_COMPILER_CLANG_ANALYZER
@ -204,8 +224,10 @@ namespace bgfx
#elif BX_PLATFORM_LINUX
extern void* g_bgfxX11Display;
extern uint32_t g_bgfxX11Window;
extern void* g_bgfxGLX;
#elif BX_PLATFORM_OSX
extern void* g_bgfxNSWindow;
extern void* g_bgfxNSGL;
#elif BX_PLATFORM_WINDOWS
extern ::HWND g_bgfxHwnd;
#elif BX_PLATFORM_WINRT
@ -1418,7 +1440,10 @@ namespace bgfx
{
Binding& sampler = m_draw.m_bind[_stage];
sampler.m_idx = _handle.idx;
sampler.m_un.m_draw.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS) ? BGFX_SAMPLER_DEFAULT_FLAGS : _flags;
sampler.m_un.m_draw.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS)
? BGFX_SAMPLER_DEFAULT_FLAGS
: _flags
;
if (isValid(_sampler)
&& (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) )
@ -1989,6 +2014,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyIndexBuffer(IndexBufferHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyIndexBuffer", m_indexBufferHandle, _handle);
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyIndexBuffer);
cmdbuf.write(_handle);
m_submit->free(_handle);
@ -2034,6 +2061,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyVertexBuffer(VertexBufferHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyVertexBuffer", m_vertexBufferHandle, _handle);
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexBuffer);
cmdbuf.write(_handle);
m_submit->free(_handle);
@ -2135,6 +2164,8 @@ namespace bgfx
BGFX_API_FUNC(void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, const Memory* _mem) )
{
BGFX_CHECK_HANDLE("updateDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle);
DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx];
BX_CHECK(0 == (dib.m_flags & BGFX_BUFFER_COMPUTE_READ_WRITE), "Can't update GPU buffer from CPU.");
@ -2166,6 +2197,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle);
m_freeDynamicIndexBufferHandle[m_numFreeDynamicIndexBufferHandles++] = _handle;
}
@ -2279,6 +2312,8 @@ namespace bgfx
BGFX_API_FUNC(void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem) )
{
BGFX_CHECK_HANDLE("updateDynamicVertexBuffer", m_dynamicVertexBufferHandle, _handle);
DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
BX_CHECK(0 == (dvb.m_flags & BGFX_BUFFER_COMPUTE_READ_WRITE), "Can't update GPU buffer from CPU.");
@ -2311,6 +2346,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyDynamicVertexBuffer", m_dynamicVertexBufferHandle, _handle);
m_freeDynamicVertexBufferHandle[m_numFreeDynamicVertexBufferHandles++] = _handle;
}
@ -2593,6 +2630,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyShader(ShaderHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyShader", m_shaderHandle, _handle);
if (!isValid(_handle) )
{
BX_WARN(false, "Passing invalid shader handle to bgfx::destroyShader.");
@ -2704,6 +2743,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyProgram(ProgramHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyProgram", m_programHandle, _handle);
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyProgram);
cmdbuf.write(_handle);
m_submit->free(_handle);
@ -2769,6 +2810,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyTexture(TextureHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyTexture", m_textureHandle, _handle);
if (!isValid(_handle) )
{
BX_WARN(false, "Passing invalid texture handle to bgfx::destroyTexture");
@ -2832,6 +2875,7 @@ namespace bgfx
for (uint32_t ii = 0; ii < _num; ++ii)
{
TextureHandle texHandle = _handles[ii];
BGFX_CHECK_HANDLE("createFrameBuffer texture handle", m_textureHandle, texHandle);
cmdbuf.write(texHandle);
@ -2868,6 +2912,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyFrameBuffer(FrameBufferHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyFrameBuffer", m_frameBufferHandle, _handle);
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyFrameBuffer);
cmdbuf.write(_handle);
m_submit->free(_handle);
@ -2951,6 +2997,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyUniform(UniformHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyUniform", m_uniformHandle, _handle);
UniformRef& uniform = m_uniformRef[_handle.idx];
BX_CHECK(uniform.m_refCount > 0, "Destroying already destroyed uniform %d.", _handle.idx);
int32_t refs = --uniform.m_refCount;
@ -3054,6 +3102,7 @@ namespace bgfx
BGFX_API_FUNC(void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) )
{
BGFX_CHECK_HANDLE_INVALID_OK("setViewFrameBuffer", m_frameBufferHandle, _handle);
m_fb[_id] = _handle;
}
@ -3091,7 +3140,7 @@ namespace bgfx
BGFX_API_FUNC(void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap) )
{
const uint32_t num = bx::uint32_min( (BGFX_CONFIG_MAX_VIEWS - _id) + _num, BGFX_CONFIG_MAX_VIEWS) - _id;
const uint32_t num = bx::uint32_min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id;
if (NULL == _remap)
{
for (uint32_t ii = 0; ii < num; ++ii)
@ -3148,6 +3197,7 @@ namespace bgfx
BGFX_API_FUNC(void setUniform(UniformHandle _handle, const void* _value, uint16_t _num) )
{
BGFX_CHECK_HANDLE("setUniform", m_uniformHandle, _handle);
UniformRef& uniform = m_uniformRef[_handle.idx];
BX_CHECK(uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num);
m_submit->writeUniform(uniform.m_type, _handle, _value, bx::uint16_min(uniform.m_num, _num) );
@ -3155,11 +3205,13 @@ namespace bgfx
BGFX_API_FUNC(void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) )
{
BGFX_CHECK_HANDLE("setIndexBuffer", m_indexBufferHandle, _handle);
m_submit->setIndexBuffer(_handle, _firstIndex, _numIndices);
}
BGFX_API_FUNC(void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) )
{
BGFX_CHECK_HANDLE("setIndexBuffer", m_dynamicIndexBufferHandle, _handle);
m_submit->setIndexBuffer(m_dynamicIndexBuffers[_handle.idx], _firstIndex, _numIndices);
}
@ -3170,11 +3222,13 @@ namespace bgfx
BGFX_API_FUNC(void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) )
{
BGFX_CHECK_HANDLE("setVertexBuffer", m_vertexBufferHandle, _handle);
m_submit->setVertexBuffer(_handle, _startVertex, _numVertices);
}
BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) )
{
BGFX_CHECK_HANDLE("setVertexBuffer", m_dynamicVertexBufferHandle, _handle);
m_submit->setVertexBuffer(m_dynamicVertexBuffers[_handle.idx], _numVertices);
}
@ -3192,12 +3246,14 @@ namespace bgfx
BGFX_API_FUNC(void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) )
{
BGFX_CHECK_HANDLE("setInstanceDataBuffer", m_vertexBufferHandle, _handle);
const VertexBuffer& vb = m_vertexBuffers[_handle.idx];
m_submit->setInstanceDataBuffer(_handle, _startVertex, _num, vb.m_stride);
}
BGFX_API_FUNC(void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) )
{
BGFX_CHECK_HANDLE("setInstanceDataBuffer", m_dynamicVertexBufferHandle, _handle);
const DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
m_submit->setInstanceDataBuffer(dvb.m_handle
, dvb.m_startVertex + _startVertex
@ -3208,16 +3264,19 @@ namespace bgfx
BGFX_API_FUNC(void setProgram(ProgramHandle _handle) )
{
BGFX_CHECK_HANDLE("setProgram", m_programHandle, _handle);
m_submit->setProgram(_handle);
}
BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) )
{
BGFX_CHECK_HANDLE_INVALID_OK("setTexture/TextureHandle", m_textureHandle, _handle);
m_submit->setTexture(_stage, _sampler, _handle, _flags);
}
BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, uint32_t _flags) )
{
BGFX_CHECK_HANDLE_INVALID_OK("setTexture/FrameBufferHandle", m_frameBufferHandle, _handle);
BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
TextureHandle textureHandle = BGFX_INVALID_HANDLE;
if (isValid(_handle) )
@ -3238,22 +3297,26 @@ namespace bgfx
BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) )
{
BGFX_CHECK_HANDLE("setBuffer", m_indexBufferHandle, _handle);
m_submit->setBuffer(_stage, _handle, _access);
}
BGFX_API_FUNC(void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) )
{
BGFX_CHECK_HANDLE("setBuffer", m_vertexBufferHandle, _handle);
m_submit->setBuffer(_stage, _handle, _access);
}
BGFX_API_FUNC(void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) )
{
BGFX_CHECK_HANDLE("setBuffer", m_dynamicIndexBufferHandle, _handle);
const DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx];
m_submit->setBuffer(_stage, dib.m_handle, _access);
}
BGFX_API_FUNC(void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) )
{
BGFX_CHECK_HANDLE("setBuffer", m_dynamicVertexBufferHandle, _handle);
const DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
m_submit->setBuffer(_stage, dvb.m_handle, _access);
}

View File

@ -8,7 +8,7 @@
#if BX_PLATFORM_IOS
namespace bgfx
namespace bgfx { namespace gl
{
struct SwapChainGL;
@ -48,7 +48,7 @@ namespace bgfx
GLuint m_colorRbo;
GLuint m_depthStencilRbo;
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_IOS

View File

@ -10,7 +10,7 @@
# include <QuartzCore/CAEAGLLayer.h>
# include "renderer_gl.h"
namespace bgfx
namespace bgfx { namespace gl
{
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
# include "glimports.h"
@ -123,6 +123,6 @@ namespace bgfx
{
}
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)

View File

@ -22,7 +22,7 @@
# define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
#endif // EGL_CONTEXT_MINOR_VERSION_KHR
namespace bgfx
namespace bgfx { namespace gl
{
#if BGFX_USE_GL_DYNAMIC_LIB
@ -369,7 +369,7 @@ EGL_IMPORT
# include "glimports.h"
}
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
# endif // BGFX_USE_EGL
#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View File

@ -10,7 +10,7 @@
#include <EGL/egl.h>
namespace bgfx
namespace bgfx { namespace gl
{
struct SwapChainGL;
@ -48,7 +48,7 @@ namespace bgfx
EGLDisplay m_display;
EGLSurface m_surface;
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_EGL

View File

@ -12,7 +12,7 @@
# define GLX_GLXEXT_PROTOTYPES
# include <glx/glxext.h>
namespace bgfx
namespace bgfx { namespace gl
{
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval);
@ -55,122 +55,128 @@ namespace bgfx
void GlContext::create(uint32_t _width, uint32_t _height)
{
BX_UNUSED(_width, _height);
XLockDisplay( (::Display*)g_bgfxX11Display);
int major, minor;
bool version = glXQueryVersion( (::Display*)g_bgfxX11Display, &major, &minor);
BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
, Fatal::UnableToInitialize
, "GLX version is not >=1.2 (%d.%d)."
, major
, minor
);
m_context = (GLXContext)g_bgfxGLX;
int32_t screen = DefaultScreen( (::Display*)g_bgfxX11Display);
const char* extensions = glXQueryExtensionsString( (::Display*)g_bgfxX11Display, screen);
BX_TRACE("GLX extensions:");
dumpExtensions(extensions);
const int attrsGlx[] =
if (NULL == g_bgfxGLX)
{
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_DOUBLEBUFFER, true,
GLX_RED_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_GREEN_SIZE, 8,
// GLX_ALPHA_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_STENCIL_SIZE, 8,
0,
};
XLockDisplay( (::Display*)g_bgfxX11Display);
// Find suitable config
GLXFBConfig bestConfig = NULL;
int major, minor;
bool version = glXQueryVersion( (::Display*)g_bgfxX11Display, &major, &minor);
BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
, Fatal::UnableToInitialize
, "GLX version is not >=1.2 (%d.%d)."
, major
, minor
);
int numConfigs;
GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_bgfxX11Display, screen, attrsGlx, &numConfigs);
int32_t screen = DefaultScreen( (::Display*)g_bgfxX11Display);
BX_TRACE("glX num configs %d", numConfigs);
const char* extensions = glXQueryExtensionsString( (::Display*)g_bgfxX11Display, screen);
BX_TRACE("GLX extensions:");
dumpExtensions(extensions);
for (int ii = 0; ii < numConfigs; ++ii)
{
m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_bgfxX11Display, configs[ii]);
if (NULL != m_visualInfo)
const int attrsGlx[] =
{
BX_TRACE("---");
bool valid = true;
for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
{
int value;
glXGetFBConfigAttrib( (::Display*)g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
, ii
, numConfigs
, attr/2
, attrsGlx[attr]
, value
, attrsGlx[attr + 1]
, value < attrsGlx[attr + 1] ? " *" : ""
);
if (value < attrsGlx[attr + 1])
{
valid = false;
#if !BGFX_CONFIG_DEBUG
break;
#endif // BGFX_CONFIG_DEBUG
}
}
if (valid)
{
bestConfig = configs[ii];
BX_TRACE("Best config %d.", ii);
break;
}
}
XFree(m_visualInfo);
m_visualInfo = NULL;
}
XFree(configs);
BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
BX_TRACE("Create GL 2.1 context.");
m_context = glXCreateContext( (::Display*)g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
#if BGFX_CONFIG_RENDERER_OPENGL >= 31
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress( (const GLubyte*)"glXCreateContextAttribsARB");
if (NULL != glXCreateContextAttribsARB)
{
BX_TRACE("Create GL 3.1 context.");
const int contextAttrs[] =
{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_DOUBLEBUFFER, true,
GLX_RED_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_GREEN_SIZE, 8,
// GLX_ALPHA_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_STENCIL_SIZE, 8,
0,
};
GLXContext context = glXCreateContextAttribsARB( (::Display*)g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
// Find suitable config
GLXFBConfig bestConfig = NULL;
if (NULL != context)
int numConfigs;
GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_bgfxX11Display, screen, attrsGlx, &numConfigs);
BX_TRACE("glX num configs %d", numConfigs);
for (int ii = 0; ii < numConfigs; ++ii)
{
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
m_context = context;
m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_bgfxX11Display, configs[ii]);
if (NULL != m_visualInfo)
{
BX_TRACE("---");
bool valid = true;
for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
{
int value;
glXGetFBConfigAttrib( (::Display*)g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
, ii
, numConfigs
, attr/2
, attrsGlx[attr]
, value
, attrsGlx[attr + 1]
, value < attrsGlx[attr + 1] ? " *" : ""
);
if (value < attrsGlx[attr + 1])
{
valid = false;
#if !BGFX_CONFIG_DEBUG
break;
#endif // BGFX_CONFIG_DEBUG
}
}
if (valid)
{
bestConfig = configs[ii];
BX_TRACE("Best config %d.", ii);
break;
}
}
XFree(m_visualInfo);
m_visualInfo = NULL;
}
XFree(configs);
BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
BX_TRACE("Create GL 2.1 context.");
m_context = glXCreateContext( (::Display*)g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
#if BGFX_CONFIG_RENDERER_OPENGL >= 31
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress( (const GLubyte*)"glXCreateContextAttribsARB");
if (NULL != glXCreateContextAttribsARB)
{
BX_TRACE("Create GL 3.1 context.");
const int contextAttrs[] =
{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
0,
};
GLXContext context = glXCreateContextAttribsARB( (::Display*)g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
if (NULL != context)
{
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
m_context = context;
}
}
}
#else
BX_UNUSED(bestConfig);
BX_UNUSED(bestConfig);
#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
XUnlockDisplay( (::Display*)g_bgfxX11Display);
XUnlockDisplay( (::Display*)g_bgfxX11Display);
}
import();
@ -210,8 +216,13 @@ namespace bgfx
void GlContext::destroy()
{
glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0);
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
XFree(m_visualInfo);
if (NULL == g_bgfxGLX)
{
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
XFree(m_visualInfo);
}
m_context = NULL;
m_visualInfo = NULL;
}
void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync)
@ -292,7 +303,7 @@ namespace bgfx
# include "glimports.h"
}
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
# endif // BGFX_USE_GLX

View File

@ -11,7 +11,7 @@
# include <X11/Xlib.h>
# include <GL/glx.h>
namespace bgfx
namespace bgfx { namespace gl
{
struct SwapChainGL;
@ -45,7 +45,7 @@ namespace bgfx
GLXContext m_context;
XVisualInfo* m_visualInfo;
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_GLX

View File

@ -8,7 +8,7 @@
#if BX_PLATFORM_OSX
namespace bgfx
namespace bgfx { namespace gl
{
struct SwapChainGL;
@ -39,7 +39,7 @@ namespace bgfx
void* m_view;
void* m_context;
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_OSX

View File

@ -10,7 +10,7 @@
# include <Cocoa/Cocoa.h>
# include <bx/os.h>
namespace bgfx
namespace bgfx { namespace gl
{
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
@ -35,7 +35,7 @@ namespace bgfx
{
}
};
static void* s_opengl = NULL;
void GlContext::create(uint32_t _width, uint32_t _height)
@ -46,56 +46,63 @@ namespace bgfx
BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");
NSWindow* nsWindow = (NSWindow*)g_bgfxNSWindow;
m_context = g_bgfxNSGL;
NSOpenGLPixelFormatAttribute profile =
if (NULL == g_bgfxNSGL)
{
NSOpenGLPixelFormatAttribute profile =
#if BGFX_CONFIG_RENDERER_OPENGL >= 31
NSOpenGLProfileVersion3_2Core
NSOpenGLProfileVersion3_2Core
#else
NSOpenGLProfileVersionLegacy
NSOpenGLProfileVersionLegacy
#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
;
;
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
NSOpenGLPFAOpenGLProfile, profile,
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADepthSize, 24,
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFADoubleBuffer, true,
NSOpenGLPFAAccelerated, true,
NSOpenGLPFANoRecovery, true,
0, 0,
};
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
NSOpenGLPFAOpenGLProfile, profile,
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADepthSize, 24,
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFADoubleBuffer, true,
NSOpenGLPFAAccelerated, true,
NSOpenGLPFANoRecovery, true,
0, 0,
};
NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
NSRect glViewRect = [[nsWindow contentView] bounds];
NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
[pixelFormat release];
[nsWindow setContentView:glView];
NSOpenGLContext* glContext = [glView openGLContext];
BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
NSRect glViewRect = [[nsWindow contentView] bounds];
NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
[glContext makeCurrentContext];
GLint interval = 0;
[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
m_view = glView;
m_context = glContext;
[pixelFormat release];
[nsWindow setContentView:glView];
NSOpenGLContext* glContext = [glView openGLContext];
BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
[glContext makeCurrentContext];
GLint interval = 0;
[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
m_view = glView;
m_context = glContext;
}
import();
}
void GlContext::destroy()
{
NSOpenGLView* glView = (NSOpenGLView*)m_view;
m_view = 0;
m_context = 0;
[glView release];
if (NULL == g_bgfxNSGL)
{
NSOpenGLView* glView = (NSOpenGLView*)m_view;
[glView release];
}
m_view = 0;
m_context = 0;
bx::dlclose(s_opengl);
}
@ -165,6 +172,6 @@ namespace bgfx
# include "glimports.h"
}
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)

View File

@ -9,14 +9,14 @@
# include <bgfxplatform.h>
# include "renderer_gl.h"
namespace bgfx
namespace bgfx { namespace gl
{
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
# include "glimports.h"
void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/);
PP_CompletionCallback naclSwapComplete =
PP_CompletionCallback naclSwapComplete =
{
naclSwapCompleteCb,
NULL,
@ -62,7 +62,7 @@ namespace bgfx
PostSwapBuffersFn m_postSwapBuffers;
bool m_forceSwap;
};
static Ppapi s_ppapi;
void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/)
@ -95,11 +95,6 @@ namespace bgfx
s_ppapi.m_instancedArrays->DrawElementsInstancedANGLE(s_ppapi.m_context, _mode, _count, _type, _indices, _primcount);
}
bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
{
return s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers);
}
bool Ppapi::setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
{
BX_TRACE("PPAPI Interfaces");
@ -192,6 +187,14 @@ namespace bgfx
return s_ppapi.isValid();
}
} /* namespace gl */ } // namespace bgfx
namespace bgfx
{
bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
{
return gl::s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers);
}
} // namespace bgfx
#endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View File

@ -13,7 +13,7 @@
# include <ppapi/c/ppb_instance.h>
# include <ppapi/c/ppb_graphics_3d.h>
namespace bgfx
namespace bgfx { namespace gl
{
struct SwapChainGL;
@ -36,7 +36,7 @@ namespace bgfx
void import();
bool isValid() const;
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_NACL

View File

@ -10,7 +10,7 @@
# if BGFX_USE_WGL
namespace bgfx
namespace bgfx { namespace gl
{
PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
PFNWGLMAKECURRENTPROC wglMakeCurrent;
@ -376,7 +376,7 @@ namespace bgfx
# include "glimports.h"
}
} // namespace bgfx
} } // namespace bgfx
# endif // BGFX_USE_WGL
#endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)

View File

@ -10,7 +10,7 @@
#include <wgl/wglext.h>
namespace bgfx
namespace bgfx { namespace gl
{
typedef PROC (APIENTRYP PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc);
typedef BOOL (APIENTRYP PFNWGLMAKECURRENTPROC) (HDC hdc, HGLRC hglrc);
@ -93,7 +93,7 @@ typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum z
HGLRC m_context;
HDC m_hdc;
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_WGL

View File

@ -1235,49 +1235,49 @@ namespace bgfx
#define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U')
#define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0')
#define D3DFMT_A8R8G8B8 21
#define D3DFMT_R5G6B5 23
#define D3DFMT_A1R5G5B5 25
#define D3DFMT_A4R4G4B4 26
#define D3DFMT_A2B10G10R10 31
#define D3DFMT_G16R16 34
#define D3DFMT_A2R10G10B10 35
#define D3DFMT_A16B16G16R16 36
#define D3DFMT_A8L8 51
#define D3DFMT_R16F 111
#define D3DFMT_G16R16F 112
#define D3DFMT_A16B16G16R16F 113
#define D3DFMT_R32F 114
#define D3DFMT_G32R32F 115
#define D3DFMT_A32B32G32R32F 116
#define DDS_A8R8G8B8 21
#define DDS_R5G6B5 23
#define DDS_A1R5G5B5 25
#define DDS_A4R4G4B4 26
#define DDS_A2B10G10R10 31
#define DDS_G16R16 34
#define DDS_A2R10G10B10 35
#define DDS_A16B16G16R16 36
#define DDS_A8L8 51
#define DDS_R16F 111
#define DDS_G16R16F 112
#define DDS_A16B16G16R16F 113
#define DDS_R32F 114
#define DDS_G32R32F 115
#define DDS_A32B32G32R32F 116
#define DXGI_FORMAT_R32G32B32A32_FLOAT 2
#define DXGI_FORMAT_R32G32B32A32_UINT 3
#define DXGI_FORMAT_R16G16B16A16_FLOAT 10
#define DXGI_FORMAT_R16G16B16A16_UNORM 11
#define DXGI_FORMAT_R16G16B16A16_UINT 12
#define DXGI_FORMAT_R32G32_FLOAT 16
#define DXGI_FORMAT_R32G32_UINT 17
#define DXGI_FORMAT_R10G10B10A2_UNORM 24
#define DXGI_FORMAT_R16G16_FLOAT 34
#define DXGI_FORMAT_R16G16_UNORM 35
#define DXGI_FORMAT_R32_FLOAT 41
#define DXGI_FORMAT_R32_UINT 42
#define DXGI_FORMAT_R8G8_UNORM 49
#define DXGI_FORMAT_R16_FLOAT 54
#define DXGI_FORMAT_R16_UNORM 56
#define DXGI_FORMAT_R8_UNORM 61
#define DXGI_FORMAT_BC1_UNORM 71
#define DXGI_FORMAT_BC2_UNORM 74
#define DXGI_FORMAT_BC3_UNORM 77
#define DXGI_FORMAT_BC4_UNORM 80
#define DXGI_FORMAT_BC5_UNORM 83
#define DXGI_FORMAT_B5G6R5_UNORM 85
#define DXGI_FORMAT_B5G5R5A1_UNORM 86
#define DXGI_FORMAT_B8G8R8A8_UNORM 87
#define DXGI_FORMAT_BC6H_SF16 96
#define DXGI_FORMAT_BC7_UNORM 98
#define DXGI_FORMAT_B4G4R4A4_UNORM 115
#define DDS_FORMAT_R32G32B32A32_FLOAT 2
#define DDS_FORMAT_R32G32B32A32_UINT 3
#define DDS_FORMAT_R16G16B16A16_FLOAT 10
#define DDS_FORMAT_R16G16B16A16_UNORM 11
#define DDS_FORMAT_R16G16B16A16_UINT 12
#define DDS_FORMAT_R32G32_FLOAT 16
#define DDS_FORMAT_R32G32_UINT 17
#define DDS_FORMAT_R10G10B10A2_UNORM 24
#define DDS_FORMAT_R16G16_FLOAT 34
#define DDS_FORMAT_R16G16_UNORM 35
#define DDS_FORMAT_R32_FLOAT 41
#define DDS_FORMAT_R32_UINT 42
#define DDS_FORMAT_R8G8_UNORM 49
#define DDS_FORMAT_R16_FLOAT 54
#define DDS_FORMAT_R16_UNORM 56
#define DDS_FORMAT_R8_UNORM 61
#define DDS_FORMAT_BC1_UNORM 71
#define DDS_FORMAT_BC2_UNORM 74
#define DDS_FORMAT_BC3_UNORM 77
#define DDS_FORMAT_BC4_UNORM 80
#define DDS_FORMAT_BC5_UNORM 83
#define DDS_FORMAT_B5G6R5_UNORM 85
#define DDS_FORMAT_B5G5R5A1_UNORM 86
#define DDS_FORMAT_B8G8R8A8_UNORM 87
#define DDS_FORMAT_BC6H_SF16 96
#define DDS_FORMAT_BC7_UNORM 98
#define DDS_FORMAT_B4G4R4A4_UNORM 115
#define DDSD_CAPS 0x00000001
#define DDSD_HEIGHT 0x00000002
@ -1331,57 +1331,57 @@ namespace bgfx
{ DDS_BC4U, TextureFormat::BC4 },
{ DDS_ATI2, TextureFormat::BC5 },
{ DDS_BC5U, TextureFormat::BC5 },
{ D3DFMT_A16B16G16R16, TextureFormat::RGBA16 },
{ D3DFMT_A16B16G16R16F, TextureFormat::RGBA16F },
{ DDS_A16B16G16R16, TextureFormat::RGBA16 },
{ DDS_A16B16G16R16F, TextureFormat::RGBA16F },
{ DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8 },
{ DDPF_INDEXED, TextureFormat::R8 },
{ DDPF_LUMINANCE, TextureFormat::R8 },
{ DDPF_ALPHA, TextureFormat::R8 },
{ D3DFMT_R16F, TextureFormat::R16F },
{ D3DFMT_R32F, TextureFormat::R32F },
{ D3DFMT_A8L8, TextureFormat::RG8 },
{ D3DFMT_G16R16, TextureFormat::RG16 },
{ D3DFMT_G16R16F, TextureFormat::RG16F },
{ D3DFMT_G32R32F, TextureFormat::RG32F },
{ D3DFMT_A8R8G8B8, TextureFormat::BGRA8 },
{ D3DFMT_A16B16G16R16, TextureFormat::RGBA16 },
{ D3DFMT_A16B16G16R16F, TextureFormat::RGBA16F },
{ D3DFMT_A32B32G32R32F, TextureFormat::RGBA32F },
{ D3DFMT_R5G6B5, TextureFormat::R5G6B5 },
{ D3DFMT_A4R4G4B4, TextureFormat::RGBA4 },
{ D3DFMT_A1R5G5B5, TextureFormat::RGB5A1 },
{ D3DFMT_A2B10G10R10, TextureFormat::RGB10A2 },
{ DDS_R16F, TextureFormat::R16F },
{ DDS_R32F, TextureFormat::R32F },
{ DDS_A8L8, TextureFormat::RG8 },
{ DDS_G16R16, TextureFormat::RG16 },
{ DDS_G16R16F, TextureFormat::RG16F },
{ DDS_G32R32F, TextureFormat::RG32F },
{ DDS_A8R8G8B8, TextureFormat::BGRA8 },
{ DDS_A16B16G16R16, TextureFormat::RGBA16 },
{ DDS_A16B16G16R16F, TextureFormat::RGBA16F },
{ DDS_A32B32G32R32F, TextureFormat::RGBA32F },
{ DDS_R5G6B5, TextureFormat::R5G6B5 },
{ DDS_A4R4G4B4, TextureFormat::RGBA4 },
{ DDS_A1R5G5B5, TextureFormat::RGB5A1 },
{ DDS_A2B10G10R10, TextureFormat::RGB10A2 },
};
static TranslateDdsFormat s_translateDxgiFormat[] =
{
{ DXGI_FORMAT_BC1_UNORM, TextureFormat::BC1 },
{ DXGI_FORMAT_BC2_UNORM, TextureFormat::BC2 },
{ DXGI_FORMAT_BC3_UNORM, TextureFormat::BC3 },
{ DXGI_FORMAT_BC4_UNORM, TextureFormat::BC4 },
{ DXGI_FORMAT_BC5_UNORM, TextureFormat::BC5 },
{ DXGI_FORMAT_BC6H_SF16, TextureFormat::BC6H },
{ DXGI_FORMAT_BC7_UNORM, TextureFormat::BC7 },
{ DDS_FORMAT_BC1_UNORM, TextureFormat::BC1 },
{ DDS_FORMAT_BC2_UNORM, TextureFormat::BC2 },
{ DDS_FORMAT_BC3_UNORM, TextureFormat::BC3 },
{ DDS_FORMAT_BC4_UNORM, TextureFormat::BC4 },
{ DDS_FORMAT_BC5_UNORM, TextureFormat::BC5 },
{ DDS_FORMAT_BC6H_SF16, TextureFormat::BC6H },
{ DDS_FORMAT_BC7_UNORM, TextureFormat::BC7 },
{ DXGI_FORMAT_R8_UNORM, TextureFormat::R8 },
{ DXGI_FORMAT_R16_UNORM, TextureFormat::R16 },
{ DXGI_FORMAT_R16_FLOAT, TextureFormat::R16F },
{ DXGI_FORMAT_R32_UINT, TextureFormat::R32 },
{ DXGI_FORMAT_R32_FLOAT, TextureFormat::R32F },
{ DXGI_FORMAT_R8G8_UNORM, TextureFormat::RG8 },
{ DXGI_FORMAT_R16G16_UNORM, TextureFormat::RG16 },
{ DXGI_FORMAT_R16G16_FLOAT, TextureFormat::RG16F },
{ DXGI_FORMAT_R32G32_UINT, TextureFormat::RG32 },
{ DXGI_FORMAT_R32G32_FLOAT, TextureFormat::RG32F },
{ DXGI_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 },
{ DXGI_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 },
{ DXGI_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
{ DXGI_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 },
{ DXGI_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
{ DXGI_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 },
{ DXGI_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 },
{ DXGI_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 },
{ DXGI_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 },
{ DDS_FORMAT_R8_UNORM, TextureFormat::R8 },
{ DDS_FORMAT_R16_UNORM, TextureFormat::R16 },
{ DDS_FORMAT_R16_FLOAT, TextureFormat::R16F },
{ DDS_FORMAT_R32_UINT, TextureFormat::R32 },
{ DDS_FORMAT_R32_FLOAT, TextureFormat::R32F },
{ DDS_FORMAT_R8G8_UNORM, TextureFormat::RG8 },
{ DDS_FORMAT_R16G16_UNORM, TextureFormat::RG16 },
{ DDS_FORMAT_R16G16_FLOAT, TextureFormat::RG16F },
{ DDS_FORMAT_R32G32_UINT, TextureFormat::RG32 },
{ DDS_FORMAT_R32G32_FLOAT, TextureFormat::RG32F },
{ DDS_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 },
{ DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 },
{ DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
{ DDS_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 },
{ DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
{ DDS_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 },
{ DDS_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 },
{ DDS_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 },
{ DDS_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 },
};
struct TranslateDdsPixelFormat

View File

@ -123,7 +123,9 @@ namespace bgfx
result = ovrHmd_ConfigureRendering(m_hmd
, _config
, 0
| ovrDistortionCap_Chromatic
#if OVR_VERSION < OVR_VERSION_050
| ovrDistortionCap_Chromatic // permanently enabled >= v5.0
#endif
| ovrDistortionCap_Vignette
| ovrDistortionCap_TimeWarp
| ovrDistortionCap_Overdrive

View File

@ -3,21 +3,35 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#ifndef BGFX_OVR_H_HEADER_GUARD
#define BGFX_OVR_H_HEADER_GUARD
#include "bgfx_p.h"
#if BGFX_CONFIG_USE_OVR
# include <OVR.h>
# include <OVR_Version.h>
# define OVR_VERSION_(_a, _b, _c) (_a * 10000 + _b * 100 + _c)
# define OVR_VERSION OVR_VERSION_(OVR_MAJOR_VERSION, OVR_MINOR_VERSION, OVR_BUILD_VERSION)
# define OVR_VERSION_042 OVR_VERSION_(0, 4, 2)
# define OVR_VERSION_043 OVR_VERSION_(0, 4, 3)
# define OVR_VERSION_044 OVR_VERSION_(0, 4, 4)
# define OVR_VERSION_050 OVR_VERSION_(0, 5, 0)
# if OVR_VERSION < OVR_VERSION_050
# include <OVR.h>
# else
# include <OVR_CAPI.h>
# endif // OVR_VERSION < OVR_VERSION_050
# if BGFX_CONFIG_RENDERER_DIRECT3D9
# define OVR_D3D_VERSION 9
# include <OVR_D3D.h>
# if OVR_VERSION < OVR_VERSION_050
# include <OVR_D3D.h>
# else
# include <OVR_CAPI_D3D.h>
# endif
# endif // BGFX_CONFIG_RENDERER_DIRECT3D9
# if BGFX_CONFIG_RENDERER_DIRECT3D11
@ -26,11 +40,19 @@
# undef OVR_D3D_VERSION
# endif // OVR_CAPI_D3D_h
# define OVR_D3D_VERSION 11
# include <OVR_D3D.h>
# if OVR_VERSION < OVR_VERSION_050
# include <OVR_D3D.h>
# else
# include <OVR_CAPI_D3D.h>
# endif
# endif // BGFX_CONFIG_RENDERER_DIRECT3D11
# if BGFX_CONFIG_RENDERER_OPENGL
# include <OVR_GL.h>
# if OVR_VERSION < OVR_VERSION_050
# include <OVR_GL.h>
# else
# include <OVR_CAPI_GL.h>
# endif
# endif // BGFX_CONFIG_RENDERER_OPENGL
namespace bgfx
@ -146,3 +168,5 @@ namespace bgfx
} // namespace bgfx
#endif // BGFX_CONFIG_USE_OVR
#endif // BGFX_OVR_H_HEADER_GUARD

View File

@ -3,9 +3,14 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#ifndef BGFX_RENDERDOC_H_HEADER_GUARD
#define BGFX_RENDERDOC_H_HEADER_GUARD
namespace bgfx
{
void* loadRenderDoc();
void unloadRenderDoc(void*);
} // namespace bgfx
#endif // BGFX_RENDERDOC_H_HEADER_GUARD

View File

@ -3,6 +3,9 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#ifndef BGFX_RENDERER_H_HEADER_GUARD
#define BGFX_RENDERER_H_HEADER_GUARD
#include "bgfx_p.h"
namespace bgfx
@ -262,3 +265,5 @@ namespace bgfx
};
} // namespace bgfx
#endif // BGFX_RENDERER_H_HEADER_GUARD

View File

@ -8,7 +8,7 @@
#if BGFX_CONFIG_RENDERER_DIRECT3D11
# include "renderer_d3d11.h"
namespace bgfx
namespace bgfx { namespace d3d11
{
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -513,7 +513,10 @@ namespace bgfx
m_driverType = D3D_DRIVER_TYPE_HARDWARE;
IDXGIAdapter* adapter;
for (uint32_t ii = 0; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters(ii, &adapter); ++ii)
for (uint32_t ii = 0
; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters(ii, &adapter) && ii < BX_COUNTOF(g_caps.gpu)
; ++ii
)
{
DXGI_ADAPTER_DESC desc;
hr = adapter->GetDesc(&desc);
@ -536,11 +539,27 @@ namespace bgfx
, desc.SharedSystemMemory
);
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
&& 0 != strstr(description, "PerfHUD") )
g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId;
g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId;
++g_caps.numGPUs;
if (NULL == m_adapter)
{
m_adapter = adapter;
m_driverType = D3D_DRIVER_TYPE_REFERENCE;
if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId)
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
&& ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
{
m_adapter = adapter;
m_adapter->AddRef();
m_driverType = D3D_DRIVER_TYPE_UNKNOWN;
}
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
&& 0 != strstr(description, "PerfHUD") )
{
m_adapter = adapter;
m_driverType = D3D_DRIVER_TYPE_REFERENCE;
}
}
}
@ -594,6 +613,11 @@ namespace bgfx
}
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
if (NULL != m_adapter)
{
DX_RELEASE(m_adapter, 2);
}
IDXGIDevice* device = NULL;
hr = E_FAIL;
for (uint32_t ii = 0; ii < BX_COUNTOF(s_deviceIIDs) && FAILED(hr); ++ii)
@ -616,6 +640,8 @@ namespace bgfx
hr = adapter->GetDesc(&m_adapterDesc);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
g_caps.vendorId = (uint16_t)m_adapterDesc.VendorId;
g_caps.deviceId = (uint16_t)m_adapterDesc.DeviceId;
#if BX_PLATFORM_WINRT
hr = adapter->GetParent(__uuidof(IDXGIFactory2), (void**)&m_factory);
@ -673,6 +699,7 @@ namespace bgfx
m_numWindows = 1;
#if !defined(__MINGW32__)
if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
{
ID3D11InfoQueue* infoQueue;
@ -704,6 +731,7 @@ namespace bgfx
setGraphicsDebuggerPresent(true);
}
}
#endif // __MINGW__
UniformHandle handle = BGFX_INVALID_HANDLE;
for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii)
@ -734,7 +762,7 @@ namespace bgfx
{
D3D11_FEATURE_DATA_FORMAT_SUPPORT data; // D3D11_FEATURE_DATA_FORMAT_SUPPORT2
data.InFormat = s_textureFormat[ii].m_fmt;
HRESULT hr = m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) );
hr = m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) );
if (SUCCEEDED(hr) )
{
support |= 0 != (data.OutFormatSupport & (0
@ -2299,14 +2327,14 @@ namespace bgfx
static RendererContextD3D11* s_renderD3D11;
RendererContextI* rendererCreateD3D11()
RendererContextI* rendererCreate()
{
s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11);
s_renderD3D11->init();
return s_renderD3D11;
}
void rendererDestroyD3D11()
void rendererDestroy()
{
s_renderD3D11->shutdown();
BX_DELETE(g_allocator, s_renderD3D11);
@ -3123,6 +3151,7 @@ namespace bgfx
uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {};
uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {};
uint32_t statsNumIndices = 0;
uint32_t statsKeyType[2] = {};
if (0 == (_render->m_debug&BGFX_DEBUG_IFH) )
{
@ -3135,6 +3164,8 @@ namespace bgfx
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
{
const bool isCompute = key.decode(_render->m_sortKeys[item], _render->m_viewRemap);
statsKeyType[isCompute]++;
const bool viewChanged = 0
|| key.m_view != view
|| item == numItems
@ -3778,8 +3809,10 @@ namespace bgfx
);
double elapsedCpuMs = double(elapsed)*toMs;
tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms]"
tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms]"
, _render->m_num
, statsKeyType[0]
, statsKeyType[1]
, elapsedCpuMs
);
for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii)
@ -3839,20 +3872,20 @@ namespace bgfx
PIX_ENDEVENT();
}
}
} // namespace bgfx
} /* namespace d3d11 */ } // namespace bgfx
#else
namespace bgfx
namespace bgfx { namespace d3d11
{
RendererContextI* rendererCreateD3D11()
RendererContextI* rendererCreate()
{
return NULL;
}
void rendererDestroyD3D11()
void rendererDestroy()
{
}
} // namespace bgfx
} /* namespace d3d11 */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_DIRECT3D11

View File

@ -49,28 +49,50 @@ BX_PRAGMA_DIAGNOSTIC_POP()
# define D3D_FEATURE_LEVEL_11_1 D3D_FEATURE_LEVEL(0xb100)
#endif // D3D_FEATURE_LEVEL_11_1
#if defined(__MINGW32__)
// MinGW Linux/Wine missing defines...
#ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
# define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8
#endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
# ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
# define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8
# endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
#ifndef D3D11_PS_CS_UAV_REGISTER_COUNT
# define D3D11_PS_CS_UAV_REGISTER_COUNT 8
#endif // D3D11_PS_CS_UAV_REGISTER_COUNT
# ifndef D3D11_PS_CS_UAV_REGISTER_COUNT
# define D3D11_PS_CS_UAV_REGISTER_COUNT 8
# endif // D3D11_PS_CS_UAV_REGISTER_COUNT
#ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
# define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8
#endif
# ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
# define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8
# endif
#ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
# define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
#endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
# ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
# define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
# endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
#ifndef D3D11_APPEND_ALIGNED_ELEMENT
# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
#endif // D3D11_APPEND_ALIGNED_ELEMENT
# ifndef D3D11_APPEND_ALIGNED_ELEMENT
# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
# endif // D3D11_APPEND_ALIGNED_ELEMENT
namespace bgfx
# ifndef D3D11_REQ_MAXANISOTROPY
# define D3D11_REQ_MAXANISOTROPY 16
# endif // D3D11_REQ_MAXANISOTROPY
# ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT
{
DXGI_FORMAT InFormat;
UINT OutFormatSupport;
} D3D11_FEATURE_DATA_FORMAT_SUPPORT;
# endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT
# ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT2
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2
{
DXGI_FORMAT InFormat;
UINT OutFormatSupport2;
} D3D11_FEATURE_DATA_FORMAT_SUPPORT2;
# endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT2
#endif // __MINGW32__
namespace bgfx { namespace d3d11
{
struct BufferD3D11
{
@ -280,6 +302,6 @@ namespace bgfx
uint8_t m_num;
};
} // namespace bgfx
} /* namespace d3d11 */ } // namespace bgfx
#endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD

View File

@ -9,16 +9,16 @@
# include "../../d3d12/src/renderer_d3d12.cpp"
#else
namespace bgfx
namespace bgfx { namespace d3d12
{
RendererContextI* rendererCreateD3D12()
RendererContextI* rendererCreate()
{
return NULL;
}
void rendererDestroyD3D12()
void rendererDestroy()
{
}
} // namespace bgfx
} /* namespace d3d12 */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_DIRECT3D12

View File

@ -8,7 +8,7 @@
#if BGFX_CONFIG_RENDERER_DIRECT3D9
# include "renderer_d3d9.h"
namespace bgfx
namespace bgfx { namespace d3d9
{
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -359,37 +359,51 @@ namespace bgfx
m_adapter = D3DADAPTER_DEFAULT;
m_deviceType = D3DDEVTYPE_HAL;
uint32_t adapterCount = m_d3d9->GetAdapterCount();
for (uint32_t ii = 0; ii < adapterCount; ++ii)
uint8_t numGPUs = bx::uint32_min(BX_COUNTOF(g_caps.gpu), m_d3d9->GetAdapterCount() );
for (uint32_t ii = 0; ii < numGPUs; ++ii)
{
D3DADAPTER_IDENTIFIER9 identifier;
HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &identifier);
D3DADAPTER_IDENTIFIER9 desc;
HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &desc);
if (SUCCEEDED(hr) )
{
{
BX_TRACE("Adapter #%d", ii);
BX_TRACE("\tDriver: %s", identifier.Driver);
BX_TRACE("\tDescription: %s", identifier.Description);
BX_TRACE("\tDeviceName: %s", identifier.DeviceName);
BX_TRACE("\tDriver: %s", desc.Driver);
BX_TRACE("\tDescription: %s", desc.Description);
BX_TRACE("\tDeviceName: %s", desc.DeviceName);
BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x"
, identifier.VendorId
, identifier.DeviceId
, identifier.SubSysId
, identifier.Revision
, desc.VendorId
, desc.DeviceId
, desc.SubSysId
, desc.Revision
);
#if BGFX_CONFIG_DEBUG_PERFHUD
if (0 != strstr(identifier.Description, "PerfHUD") )
g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId;
g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId;
if (D3DADAPTER_DEFAULT == m_adapter)
{
m_adapter = ii;
m_deviceType = D3DDEVTYPE_REF;
if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId)
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
&& ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
{
m_adapter = ii;
}
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
&& 0 != strstr(desc.Description, "PerfHUD"))
{
m_adapter = ii;
m_deviceType = D3DDEVTYPE_REF;
}
}
#endif // BGFX_CONFIG_DEBUG_PERFHUD
}
}
DX_CHECK(m_d3d9->GetAdapterIdentifier(m_adapter, 0, &m_identifier) );
m_amd = m_identifier.VendorId == 0x1002;
m_nvidia = m_identifier.VendorId == 0x10de;
m_amd = m_identifier.VendorId == BGFX_PCI_ID_AMD;
m_nvidia = m_identifier.VendorId == BGFX_PCI_ID_NVIDIA;
g_caps.vendorId = (uint16_t)m_identifier.VendorId;
g_caps.deviceId = (uint16_t)m_identifier.DeviceId;
uint32_t behaviorFlags[] =
{
@ -1731,14 +1745,14 @@ namespace bgfx
static RendererContextD3D9* s_renderD3D9;
RendererContextI* rendererCreateD3D9()
RendererContextI* rendererCreate()
{
s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9);
s_renderD3D9->init();
return s_renderD3D9;
}
void rendererDestroyD3D9()
void rendererDestroy()
{
s_renderD3D9->shutdown();
BX_DELETE(g_allocator, s_renderD3D9);
@ -2215,10 +2229,10 @@ namespace bgfx
if (NULL != _rect)
{
RECT rect;
rect.left = _rect->m_x;
rect.top = _rect->m_y;
rect.right = rect.left + _rect->m_width;
rect.bottom = rect.top + _rect->m_height;
rect.left = _rect->m_x;
rect.top = _rect->m_y;
rect.right = rect.left + _rect->m_width;
rect.bottom = rect.top + _rect->m_height;
DX_CHECK(m_texture2d->LockRect(_lod, &lockedRect, &rect, 0) );
}
else
@ -2494,7 +2508,7 @@ namespace bgfx
if (convert)
{
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat);
data = temp;
}
@ -2864,8 +2878,11 @@ namespace bgfx
FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
uint32_t blendFactor = 0;
const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
uint8_t primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
uint8_t primIndex;
{
const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
}
PrimInfo prim = s_primInfo[primIndex];
bool viewHasScissor = false;
@ -2876,6 +2893,7 @@ namespace bgfx
uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {};
uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {};
uint32_t statsNumIndices = 0;
uint32_t statsKeyType[2] = {};
invalidateSamplerState();
@ -2884,6 +2902,7 @@ namespace bgfx
for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item)
{
const bool isCompute = key.decode(_render->m_sortKeys[item], _render->m_viewRemap);
statsKeyType[isCompute]++;
if (isCompute)
{
@ -3414,8 +3433,10 @@ namespace bgfx
);
double elapsedCpuMs = double(elapsed)*toMs;
tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms]"
tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms]"
, _render->m_num
, statsKeyType[0]
, statsKeyType[1]
, elapsedCpuMs
);
for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii)
@ -3460,20 +3481,20 @@ namespace bgfx
device->EndScene();
}
} // namespace bgfx
} /* namespace d3d9 */ } // namespace bgfx
#else
namespace bgfx
namespace bgfx { namespace d3d9
{
RendererContextI* rendererCreateD3D9()
RendererContextI* rendererCreate()
{
return NULL;
}
void rendererDestroyD3D9()
void rendererDestroy()
{
}
} // namespace bgfx
} /* namespace d3d9 */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_DIRECT3D9

View File

@ -41,7 +41,7 @@
#include "renderer.h"
#include "renderer_d3d.h"
namespace bgfx
namespace bgfx { namespace d3d9
{
# if defined(D3D_DISABLE_9EX)
# define D3DFMT_S8_LOCKABLE D3DFORMAT( 85)
@ -386,6 +386,6 @@ namespace bgfx
bool m_needResolve;
};
} // namespace bgfx
} /* namespace d3d9 */ } // namespace bgfx
#endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD

View File

@ -10,7 +10,7 @@
# include <bx/timer.h>
# include <bx/uint32_t.h>
namespace bgfx
namespace bgfx { namespace gl
{
static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -237,6 +237,8 @@ namespace bgfx
};
BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
static bool s_textureFilter[TextureFormat::Count+1];
static GLenum s_rboFormat[] =
{
GL_ZERO, // BC1
@ -358,6 +360,7 @@ namespace bgfx
ANGLE_texture_compression_dxt1,
ANGLE_texture_compression_dxt3,
ANGLE_texture_compression_dxt5,
ANGLE_timer_query,
ANGLE_translated_shader_source,
APPLE_texture_format_BGRA8888,
@ -417,10 +420,13 @@ namespace bgfx
EXT_blend_color,
EXT_blend_minmax,
EXT_blend_subtract,
EXT_color_buffer_half_float,
EXT_color_buffer_float,
EXT_compressed_ETC1_RGB8_sub_texture,
EXT_debug_label,
EXT_debug_marker,
EXT_discard_framebuffer,
EXT_disjoint_timer_query,
EXT_draw_buffers,
EXT_frag_depth,
EXT_framebuffer_blit,
@ -491,10 +497,12 @@ namespace bgfx
OES_vertex_half_float,
OES_vertex_type_10_10_10_2,
WEBGL_color_buffer_float,
WEBGL_compressed_texture_etc1,
WEBGL_compressed_texture_s3tc,
WEBGL_compressed_texture_pvrtc,
WEBGL_depth_texture,
WEBGL_draw_buffers,
WEBKIT_EXT_texture_filter_anisotropic,
WEBKIT_WEBGL_compressed_texture_s3tc,
@ -508,7 +516,27 @@ namespace bgfx
bool m_initialize;
};
static Extension s_extension[Extension::Count] =
// Extension registry
//
// ANGLE:
// https://github.com/google/angle/tree/master/extensions
//
// CHROMIUM:
// https://chromium.googlesource.com/chromium/src.git/+/refs/heads/git-svn/gpu/GLES2/extensions/CHROMIUM
//
// EGL:
// https://www.khronos.org/registry/egl/extensions/
//
// GL:
// https://www.opengl.org/registry/
//
// GLES:
// https://www.khronos.org/registry/gles/extensions/
//
// WEBGL:
// https://www.khronos.org/registry/webgl/extensions/
//
static Extension s_extension[] =
{
{ "AMD_conservative_depth", false, true },
@ -519,6 +547,7 @@ namespace bgfx
{ "ANGLE_texture_compression_dxt1", false, true },
{ "ANGLE_texture_compression_dxt3", false, true },
{ "ANGLE_texture_compression_dxt5", false, true },
{ "ANGLE_timer_query", false, true },
{ "ANGLE_translated_shader_source", false, true },
{ "APPLE_texture_format_BGRA8888", false, true },
@ -578,10 +607,13 @@ namespace bgfx
{ "EXT_blend_color", BGFX_CONFIG_RENDERER_OPENGL >= 31, true },
{ "EXT_blend_minmax", BGFX_CONFIG_RENDERER_OPENGL >= 14, true },
{ "EXT_blend_subtract", BGFX_CONFIG_RENDERER_OPENGL >= 14, true },
{ "EXT_color_buffer_half_float", false, true }, // GLES2 extension.
{ "EXT_color_buffer_float", false, true }, // GLES2 extension.
{ "EXT_compressed_ETC1_RGB8_sub_texture", false, true }, // GLES2 extension.
{ "EXT_debug_label", false, true },
{ "EXT_debug_marker", false, true },
{ "EXT_discard_framebuffer", false, true }, // GLES2 extension.
{ "EXT_disjoint_timer_query", false, true }, // GLES2 extension.
{ "EXT_draw_buffers", false, true }, // GLES2 extension.
{ "EXT_frag_depth", false, true }, // GLES2 extension.
{ "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
@ -605,7 +637,7 @@ namespace bgfx
{ "EXT_texture_storage", false, true },
{ "EXT_texture_swizzle", false, true },
{ "EXT_texture_type_2_10_10_10_REV", false, true },
{ "EXT_timer_query", false, true },
{ "EXT_timer_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
{ "EXT_unpack_subimage", false, true },
{ "GOOGLE_depth_texture", false, true },
@ -652,15 +684,18 @@ namespace bgfx
{ "OES_vertex_half_float", false, true },
{ "OES_vertex_type_10_10_10_2", false, true },
{ "WEBGL_color_buffer_float", false, true },
{ "WEBGL_compressed_texture_etc1", false, true },
{ "WEBGL_compressed_texture_s3tc", false, true },
{ "WEBGL_compressed_texture_pvrtc", false, true },
{ "WEBGL_depth_texture", false, true },
{ "WEBGL_draw_buffers", false, true },
{ "WEBKIT_EXT_texture_filter_anisotropic", false, true },
{ "WEBKIT_WEBGL_compressed_texture_s3tc", false, true },
{ "WEBKIT_WEBGL_depth_texture", false, true },
};
BX_STATIC_ASSERT(Extension::Count == BX_COUNTOF(s_extension) );
static const char* s_ARB_shader_texture_lod[] =
{
@ -915,6 +950,15 @@ namespace bgfx
return 0 == err;
}
static void getFilters(uint32_t _flags, bool _hasMips, GLenum& _magFilter, GLenum& _minFilter)
{
const uint32_t mag = (_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT;
const uint32_t min = (_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT;
const uint32_t mip = (_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT;
_magFilter = s_textureFilterMag[mag];
_minFilter = s_textureFilterMin[min][_hasMips ? mip+1 : 0];
}
struct RendererContextGL : public RendererContextI
{
RendererContextGL()
@ -933,6 +977,7 @@ namespace bgfx
, m_programBinarySupport(false)
, m_textureSwizzleSupport(false)
, m_depthTextureSupport(false)
, m_timerQuerySupport(false)
, m_flip(false)
, m_hash( (BX_PLATFORM_WINDOWS<<1) | BX_ARCH_64BIT)
, m_backBufferFbo(0)
@ -1094,6 +1139,9 @@ namespace bgfx
}
}
// Allow all texture filters.
memset(s_textureFilter, true, BX_COUNTOF(s_textureFilter) );
bool bc123Supported = 0
|| s_extension[Extension::EXT_texture_compression_s3tc ].m_supported
|| s_extension[Extension::MOZ_WEBGL_compressed_texture_s3tc ].m_supported
@ -1186,6 +1234,23 @@ namespace bgfx
{
setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT);
if (s_extension[Extension::OES_texture_half_float].m_supported
|| s_extension[Extension::OES_texture_float ].m_supported)
{
// https://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt
// When half/float is available via extensions texture will be marked as
// incomplete if it uses anything other than nearest filter.
const bool linear16F = s_extension[Extension::OES_texture_half_float_linear].m_supported;
const bool linear32F = s_extension[Extension::OES_texture_float_linear ].m_supported;
s_textureFilter[TextureFormat::R16F] = linear16F;
s_textureFilter[TextureFormat::RG16F] = linear16F;
s_textureFilter[TextureFormat::RGBA16F] = linear16F;
s_textureFilter[TextureFormat::R32F] = linear32F;
s_textureFilter[TextureFormat::RG32F] = linear32F;
s_textureFilter[TextureFormat::RGBA32F] = linear32F;
}
if (BX_ENABLED(BX_PLATFORM_IOS) )
{
setTextureFormat(TextureFormat::D16, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
@ -1294,7 +1359,8 @@ namespace bgfx
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|| s_extension[Extension::EXT_draw_buffers].m_supported)
|| s_extension[Extension::EXT_draw_buffers ].m_supported
|| s_extension[Extension::WEBGL_draw_buffers].m_supported)
{
g_caps.maxFBAttachments = bx::uint32_min(glGet(GL_MAX_COLOR_ATTACHMENTS), BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
}
@ -1306,7 +1372,8 @@ namespace bgfx
if (BX_ENABLED(BX_PLATFORM_NACL) )
{
m_vaoSupport &= NULL != glGenVertexArrays
m_vaoSupport &= true
&& NULL != glGenVertexArrays
&& NULL != glDeleteVertexArrays
&& NULL != glBindVertexArray
;
@ -1346,6 +1413,15 @@ namespace bgfx
|| s_extension[Extension::WEBKIT_WEBGL_depth_texture].m_supported
;
m_timerQuerySupport = 0
|| s_extension[Extension::ANGLE_timer_query ].m_supported
|| s_extension[Extension::ARB_timer_query ].m_supported
|| s_extension[Extension::EXT_disjoint_timer_query].m_supported
|| s_extension[Extension::EXT_timer_query ].m_supported
;
m_timerQuerySupport &= NULL != glGetQueryObjectui64v;
g_caps.supported |= m_depthTextureSupport
? BGFX_CAPS_TEXTURE_COMPARE_LEQUAL
: 0
@ -1455,7 +1531,8 @@ namespace bgfx
glInvalidateFramebuffer = stubInvalidateFramebuffer;
}
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
&& m_timerQuerySupport)
{
m_queries.create();
}
@ -1485,7 +1562,8 @@ namespace bgfx
invalidateCache();
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
&& m_timerQuerySupport)
{
m_queries.destroy();
}
@ -2047,16 +2125,25 @@ namespace bgfx
{
sampler = m_samplerStateCache.add(_flags);
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]) );
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_WRAP_T, s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]) );
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_WRAP_R, s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]) );
GL_CHECK(glSamplerParameteri(sampler
, GL_TEXTURE_WRAP_S
, s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]
) );
GL_CHECK(glSamplerParameteri(sampler
, GL_TEXTURE_WRAP_T
, s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]
) );
GL_CHECK(glSamplerParameteri(sampler
, GL_TEXTURE_WRAP_R
, s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]
) );
const uint32_t mag = (_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT;
const uint32_t min = (_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT;
const uint32_t mip = (_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT;
GLenum minFilter = s_textureFilterMin[min][1 < _numMips ? mip+1 : 0];
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, s_textureFilterMag[mag]) );
GLenum minFilter;
GLenum magFilter;
getFilters(_flags, 1 < _numMips, magFilter, minFilter);
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, magFilter) );
GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, minFilter) );
if (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
&& 0.0f < m_maxAnisotropy)
{
@ -2557,6 +2644,7 @@ namespace bgfx
bool m_programBinarySupport;
bool m_textureSwizzleSupport;
bool m_depthTextureSupport;
bool m_timerQuerySupport;
bool m_flip;
uint64_t m_hash;
@ -2579,14 +2667,14 @@ namespace bgfx
RendererContextGL* s_renderGL;
RendererContextI* rendererCreateGL()
RendererContextI* rendererCreate()
{
s_renderGL = BX_NEW(g_allocator, RendererContextGL);
s_renderGL->init();
return s_renderGL;
}
void rendererDestroyGL()
void rendererDestroy()
{
s_renderGL->shutdown();
BX_DELETE(g_allocator, s_renderGL);
@ -2662,6 +2750,7 @@ namespace bgfx
GLENUM(GL_RENDERBUFFER);
GLENUM(GL_INVALID_ENUM);
GLENUM(GL_INVALID_FRAMEBUFFER_OPERATION);
GLENUM(GL_INVALID_VALUE);
GLENUM(GL_INVALID_OPERATION);
GLENUM(GL_OUT_OF_MEMORY);
@ -2861,20 +2950,20 @@ namespace bgfx
m_numPredefined = 0;
m_numSamplers = 0;
struct VariableInfo
{
GLenum type;
GLint loc;
GLint num;
};
VariableInfo vi;
GLenum props[] = { GL_TYPE, GL_LOCATION, GL_ARRAY_SIZE };
const bool piqSupported = s_extension[Extension::ARB_program_interface_query].m_supported;
BX_TRACE("Uniforms (%d):", activeUniforms);
for (int32_t ii = 0; ii < activeUniforms; ++ii)
{
struct VariableInfo
{
GLenum type;
GLint loc;
GLint num;
};
VariableInfo vi;
GLenum props[] ={ GL_TYPE, GL_LOCATION, GL_ARRAY_SIZE };
GLenum gltype;
GLint num;
GLint loc;
@ -3202,10 +3291,8 @@ namespace bgfx
BX_CHECK(0 != m_id, "Failed to generate texture id.");
GL_CHECK(glBindTexture(_target, m_id) );
setSamplerState(_flags);
const TextureFormatInfo& tfi = s_textureFormat[_format];
m_fmt = tfi.m_fmt;
m_fmt = tfi.m_fmt;
m_type = tfi.m_type;
const bool compressed = isCompressed(TextureFormat::Enum(_format) );
@ -3214,11 +3301,13 @@ namespace bgfx
if (decompress)
{
m_textureFormat = (uint8_t)TextureFormat::BGRA8;
const TextureFormatInfo& tfi = s_textureFormat[TextureFormat::BGRA8];
m_fmt = tfi.m_fmt;
m_type = tfi.m_type;
const TextureFormatInfo& tfiBgra8 = s_textureFormat[TextureFormat::BGRA8];
m_fmt = tfiBgra8.m_fmt;
m_type = tfiBgra8.m_type;
}
setSamplerState(_flags);
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
&& TextureFormat::BGRA8 == m_textureFormat
&& GL_RGBA == m_fmt
@ -3583,6 +3672,22 @@ namespace bgfx
void TextureGL::setSamplerState(uint32_t _flags)
{
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30)
&& !s_textureFilter[m_textureFormat])
{
// Force point sampling when texture format doesn't support linear sampling.
_flags &= 0
| BGFX_TEXTURE_MIN_MASK
| BGFX_TEXTURE_MAG_MASK
| BGFX_TEXTURE_MIP_MASK
;
_flags |= 0
| BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
| BGFX_TEXTURE_MIP_POINT
;
}
const uint32_t flags = (0 != (BGFX_SAMPLER_DEFAULT_FLAGS & _flags) ? m_flags : _flags) & BGFX_TEXTURE_SAMPLER_BITS_MASK;
if (flags != m_currentFlags)
{
@ -3603,11 +3708,10 @@ namespace bgfx
GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_R, s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]) );
}
const uint32_t mag = (flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT;
const uint32_t min = (flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT;
const uint32_t mip = (flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT;
const GLenum minFilter = s_textureFilterMin[min][1 < numMips ? mip+1 : 0];
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, s_textureFilterMag[mag]) );
GLenum magFilter;
GLenum minFilter;
getFilters(flags, 1 < numMips, magFilter, minFilter);
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter) );
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter) );
if (0 != (flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
&& 0.0f < s_renderGL->m_maxAnisotropy)
@ -3794,7 +3898,10 @@ namespace bgfx
if (usesFragData)
{
BX_WARN(s_extension[Extension::EXT_draw_buffers].m_supported, "EXT_draw_buffers is used but not supported by GLES2 driver.");
BX_WARN(s_extension[Extension::EXT_draw_buffers ].m_supported
|| s_extension[Extension::WEBGL_draw_buffers].m_supported
, "EXT_draw_buffers is used but not supported by GLES2 driver."
);
writeString(&writer
, "#extension GL_EXT_draw_buffers : enable\n"
);
@ -3995,9 +4102,9 @@ namespace bgfx
{
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
{
char temp[16];
bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii);
fragData = bx::uint32_max(fragData, NULL == strstr(code, temp) ? 0 : ii+1);
char tmpFragData[16];
bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii);
fragData = bx::uint32_max(fragData, NULL == strstr(code, tmpFragData) ? 0 : ii+1);
}
BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!");
@ -4197,7 +4304,8 @@ namespace bgfx
GL_CHECK(glGenFramebuffers(1, &m_fbo[1]) );
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo[1]) );
for (uint32_t ii = 0, colorIdx = 0; ii < _num; ++ii)
colorIdx = 0;
for (uint32_t ii = 0; ii < _num; ++ii)
{
TextureHandle handle = _handles[ii];
if (isValid(handle) )
@ -4345,7 +4453,8 @@ namespace bgfx
int64_t captureElapsed = 0;
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
&& (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) )
&& (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
&& m_timerQuerySupport)
{
m_queries.begin(0, GL_TIME_ELAPSED);
}
@ -4390,8 +4499,11 @@ namespace bgfx
;
uint32_t blendFactor = 0;
const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
uint8_t primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
uint8_t primIndex;
{
const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
}
PrimInfo prim = s_primInfo[primIndex];
uint32_t baseVertex = 0;
@ -4410,6 +4522,7 @@ namespace bgfx
uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {};
uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {};
uint32_t statsNumIndices = 0;
uint32_t statsKeyType[2] = {};
if (0 == (_render->m_debug&BGFX_DEBUG_IFH) )
{
@ -4424,6 +4537,8 @@ namespace bgfx
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
{
const bool isCompute = key.decode(_render->m_sortKeys[item], _render->m_viewRemap);
statsKeyType[isCompute]++;
const bool viewChanged = 0
|| key.m_view != view
|| item == numItems
@ -4783,16 +4898,15 @@ namespace bgfx
&& blendIndependentSupported
;
const uint32_t blend = uint32_t( (newFlags&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT);
const uint32_t equation = uint32_t( (newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT);
const uint32_t blend = uint32_t( (newFlags&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT);
const uint32_t srcRGB = (blend )&0xf;
const uint32_t dstRGB = (blend>> 4)&0xf;
const uint32_t srcA = (blend>> 8)&0xf;
const uint32_t dstA = (blend>>12)&0xf;
const uint32_t srcRGB = (blend )&0xf;
const uint32_t dstRGB = (blend>> 4)&0xf;
const uint32_t srcA = (blend>> 8)&0xf;
const uint32_t dstA = (blend>>12)&0xf;
const uint32_t equRGB = (equation )&0x7;
const uint32_t equA = (equation>>3)&0x7;
const uint32_t equ = uint32_t((newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT);
const uint32_t equRGB = (equ )&0x7;
const uint32_t equA = (equ>>3)&0x7;
const uint32_t numRt = getNumRt();
@ -4974,7 +5088,6 @@ namespace bgfx
currentVao = id;
GL_CHECK(glBindVertexArray(id) );
ProgramGL& program = m_program[programIdx];
program.add(hash);
if (isValid(draw.m_vertexBuffer) )
@ -5072,7 +5185,6 @@ namespace bgfx
baseVertex = draw.m_startVertex;
const VertexBufferGL& vb = m_vertexBuffers[draw.m_vertexBuffer.idx];
uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
const ProgramGL& program = m_program[programIdx];
program.bindAttributes(m_vertexDecls[decl], draw.m_startVertex);
if (isValid(draw.m_instanceDataBuffer) )
@ -5178,11 +5290,14 @@ namespace bgfx
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
double elapsedGpuMs = 0.0;
#if BGFX_CONFIG_RENDERER_OPENGL
m_queries.end(GL_TIME_ELAPSED);
uint64_t elapsedGl = m_queries.getResult(0);
elapsedGpuMs = double(elapsedGl)/1e6;
#endif // BGFX_CONFIG_RENDERER_OPENGL
uint64_t elapsedGl = 0;
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
&& m_timerQuerySupport)
{
m_queries.end(GL_TIME_ELAPSED);
elapsedGl = m_queries.getResult(0);
elapsedGpuMs = double(elapsedGl)/1e6;
}
TextVideoMem& tvm = m_textVideoMem;
@ -5225,15 +5340,17 @@ namespace bgfx
);
double elapsedCpuMs = double(elapsed)*toMs;
tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms] %c GPU %3.4f [ms]"
tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms] %c GPU %3.4f [ms]"
, _render->m_num
, statsKeyType[0]
, statsKeyType[1]
, elapsedCpuMs
, elapsedCpuMs > elapsedGpuMs ? '>' : '<'
, elapsedGpuMs
);
for (uint32_t ii = 0; ii < BX_COUNTOF(s_primInfo); ++ii)
{
tvm.printf(10, pos++, 0x8e, " %8s: %7d (#inst: %5d), submitted: %7d"
tvm.printf(10, pos++, 0x8e, " %9s: %7d (#inst: %5d), submitted: %7d"
, s_primName[ii]
, statsNumPrimsRendered[ii]
, statsNumInstances[ii]
@ -5246,9 +5363,9 @@ namespace bgfx
tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] ");
}
tvm.printf(10, pos++, 0x8e, " Indices: %7d", statsNumIndices);
tvm.printf(10, pos++, 0x8e, " DVB size: %7d", _render->m_vboffset);
tvm.printf(10, pos++, 0x8e, " DIB size: %7d", _render->m_iboffset);
tvm.printf(10, pos++, 0x8e, " Indices: %7d", statsNumIndices);
tvm.printf(10, pos++, 0x8e, " DVB size: %7d", _render->m_vboffset);
tvm.printf(10, pos++, 0x8e, " DIB size: %7d", _render->m_iboffset);
pos++;
tvm.printf(10, pos++, 0x8e, " State cache: ");
@ -5354,21 +5471,21 @@ namespace bgfx
GL_CHECK(glFrameTerminatorGREMEDY() );
}
} // namespace bgfx
} } // namespace bgfx
#else
namespace bgfx
namespace bgfx { namespace gl
{
RendererContextI* rendererCreateGL()
RendererContextI* rendererCreate()
{
return NULL;
}
void rendererDestroyGL()
void rendererDestroy()
{
}
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View File

@ -611,6 +611,10 @@ typedef uint64_t GLuint64;
namespace bgfx
{
class ConstantBuffer;
} // namespace bgfx
namespace bgfx { namespace gl
{
void dumpExtensions(const char* _extensions);
const char* glEnumName(GLenum _enum);
@ -619,9 +623,9 @@ namespace bgfx
BX_MACRO_BLOCK_BEGIN \
/*BX_TRACE(#_call);*/ \
_call; \
GLenum err = glGetError(); \
_check(0 == err, #_call "; GL error 0x%x: %s", err, glEnumName(err) ); \
BX_UNUSED(err); \
GLenum gl_err = glGetError(); \
_check(0 == gl_err, #_call "; GL error 0x%x: %s", gl_err, glEnumName(gl_err) ); \
BX_UNUSED(gl_err); \
BX_MACRO_BLOCK_END
#define IGNORE_GL_ERROR_CHECK(...) BX_NOOP()
@ -1001,6 +1005,6 @@ namespace bgfx
GLuint m_queries[64];
};
} // namespace bgfx
} /* namespace gl */ } // namespace bgfx
#endif // BGFX_RENDERER_GL_H_HEADER_GUARD

View File

@ -7,7 +7,7 @@
#if BGFX_CONFIG_RENDERER_NULL
namespace bgfx
namespace bgfx { namespace noop
{
struct RendererContextNULL : public RendererContextI
{
@ -168,31 +168,31 @@ namespace bgfx
static RendererContextNULL* s_renderNULL;
RendererContextI* rendererCreateNULL()
RendererContextI* rendererCreate()
{
s_renderNULL = BX_NEW(g_allocator, RendererContextNULL);
return s_renderNULL;
}
void rendererDestroyNULL()
void rendererDestroy()
{
BX_DELETE(g_allocator, s_renderNULL);
s_renderNULL = NULL;
}
} // namespace bgfx
} /* namespace noop */ } // namespace bgfx
#else
namespace bgfx
namespace bgfx { namespace noop
{
RendererContextI* rendererCreateNULL()
RendererContextI* rendererCreate()
{
return NULL;
}
void rendererDestroyNULL()
void rendererDestroy()
{
}
} // namespace bgfx
} /* namespace noop */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_NULL

View File

@ -8,16 +8,16 @@
# include "../../vk/src/renderer_vk.cpp"
#else
namespace bgfx
namespace bgfx { namespace vk
{
RendererContextI* rendererCreateVK()
RendererContextI* rendererCreate()
{
return NULL;
}
void rendererDestroyVK()
void rendererDestroy()
{
}
} // namespace bgfx
} /* namespace vk */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_VULKAN

View File

@ -504,11 +504,14 @@ int main(int _argc, const char* _argv[])
Triangle triangle;
memset(&triangle, 0, sizeof(Triangle) );
const int numNormals = (int)normals.size();
const int numTexcoords = (int)texcoords.size();
const int numPositions = (int)positions.size();
for (uint32_t edge = 0, numEdges = argc-1; edge < numEdges; ++edge)
{
Index3 index;
index.m_texcoord = -1;
index.m_normal = -1;
index.m_texcoord = 0;
index.m_normal = 0;
index.m_vertexIndex = -1;
char* vertex = argv[edge+1];
@ -521,13 +524,16 @@ int main(int _argc, const char* _argv[])
if (NULL != normal)
{
*normal++ = '\0';
index.m_normal = atoi(normal)-1;
const int nn = atoi(normal);
index.m_normal = (nn < 0) ? nn+numNormals : nn-1;
}
index.m_texcoord = atoi(texcoord)-1;
const int tex = atoi(texcoord);
index.m_texcoord = (tex < 0) ? tex+numTexcoords : tex-1;
}
index.m_position = atoi(vertex)-1;
const int pos = atoi(vertex);
index.m_position = (pos < 0) ? pos+numPositions : pos-1;
uint64_t hash0 = index.m_position;
uint64_t hash1 = uint64_t(index.m_texcoord)<<20;
@ -710,8 +716,8 @@ int main(int _argc, const char* _argv[])
bool hasTexcoord;
{
Index3Map::const_iterator it = indexMap.begin();
hasNormal = -1 != it->second.m_normal;
hasTexcoord = -1 != it->second.m_texcoord;
hasNormal = 0 != it->second.m_normal;
hasTexcoord = 0 != it->second.m_texcoord;
if (!hasTexcoord
&& texcoords.size() == positions.size() )

View File

@ -845,7 +845,7 @@ int main(int _argc, const char* _argv[])
preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX");
char glslDefine[128];
bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", glsl);
bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl);
if (0 == bx::stricmp(platform, "android") )
{
@ -972,9 +972,9 @@ int main(int _argc, const char* _argv[])
const char* name = parse = bx::strws(bx::strword(parse) );
const char* column = parse = bx::strws(bx::strword(parse) );
const char* semantics = parse = bx::strws(bx::strnws (parse) );
const char* semantics = parse = bx::strws((*parse == ':' ? ++parse : parse));
const char* assign = parse = bx::strws(bx::strword(parse) );
const char* init = parse = bx::strws(bx::strnws (parse) );
const char* init = parse = bx::strws((*parse == '=' ? ++parse : parse));
if (type < eol
&& name < eol
@ -1155,7 +1155,8 @@ int main(int _argc, const char* _argv[])
}
else
{
if (0 != glsl)
if (0 != glsl
|| 0 != essl)
{
}
else
@ -1269,7 +1270,8 @@ int main(int _argc, const char* _argv[])
bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
bx::write(writer, outputHash);
if (0 != glsl)
if (0 != glsl
|| 0 != essl)
{
std::string code;
@ -1338,10 +1340,11 @@ int main(int _argc, const char* _argv[])
}
else
{
if (0 != glsl)
if (0 != glsl
|| 0 != essl)
{
if (120 == glsl
|| essl)
|| 0 != essl)
{
preprocessor.writef(
"#define ivec2 vec2\n"
@ -1700,7 +1703,8 @@ int main(int _argc, const char* _argv[])
bx::write(writer, outputHash);
}
if (0 != glsl)
if (0 != glsl
|| 0 != essl)
{
std::string code;

View File

@ -8,6 +8,13 @@
#if SHADERC_CONFIG_DIRECT3D11
#include <d3dcompiler.h>
#include <d3d11shader.h>
#ifndef D3D_SVF_USED
# define D3D_SVF_USED 2
#endif // D3D_SVF_USED
static const GUID GUID_ID3D11ShaderReflection = { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } };
struct RemapInputSemantic
{
@ -202,7 +209,7 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
ID3D11ShaderReflection* reflect = NULL;
hr = D3DReflect(code->GetBufferPointer()
, code->GetBufferSize()
, IID_ID3D11ShaderReflection
, GUID_ID3D11ShaderReflection
, (void**)&reflect
);
if (FAILED(hr) )
@ -370,7 +377,7 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
ID3DBlob* stripped;
hr = D3DStripShader(code->GetBufferPointer()
, code->GetBufferSize()
, D3DCOMPILER_STRIP_REFLECTION_DATA
, D3DCOMPILER_STRIP_REFLECTION_DATA
| D3DCOMPILER_STRIP_TEST_BLOBS
, &stripped
);
@ -437,4 +444,4 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
return false;
}
#endif // SHADERC_CONFIG_DIRECT3D11
#endif // SHADERC_CONFIG_DIRECT3D11

View File

@ -71,7 +71,9 @@ namespace bx
uint16_t* sparse = &m_handles[MaxHandlesT];
uint16_t index = sparse[_handle];
return (index < m_numHandles && m_handles[index] == _handle);
return index < m_numHandles
&& m_handles[index] == _handle
;
}
void free(uint16_t _handle)

View File

@ -218,7 +218,9 @@
BX_STRINGIZE(__clang_minor__) "." \
BX_STRINGIZE(__clang_patchlevel__)
#elif BX_COMPILER_MSVC
# if BX_COMPILER_MSVC >= 1800
# if BX_COMPILER_MSVC >= 1900
# define BX_COMPILER_NAME "MSVC 14.0"
# elif BX_COMPILER_MSVC >= 1800
# define BX_COMPILER_NAME "MSVC 12.0"
# elif BX_COMPILER_MSVC >= 1700
# define BX_COMPILER_NAME "MSVC 11.0"

View File

@ -30,14 +30,16 @@ namespace bx
memset(histogram, 0, sizeof(uint16_t)*BX_RADIXSORT_HISTOGRAM_SIZE);
bool sorted = true;
uint32_t key = keys[0];
uint32_t prevKey = key;
for (uint32_t ii = 0; ii < _size; ++ii, prevKey = key)
{
key = keys[ii];
uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
++histogram[index];
sorted &= prevKey <= key;
uint32_t key = keys[0];
uint32_t prevKey = key;
for (uint32_t ii = 0; ii < _size; ++ii, prevKey = key)
{
key = keys[ii];
uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
++histogram[index];
sorted &= prevKey <= key;
}
}
if (sorted)
@ -101,14 +103,16 @@ done:
memset(histogram, 0, sizeof(uint16_t)*BX_RADIXSORT_HISTOGRAM_SIZE);
bool sorted = true;
uint64_t key = keys[0];
uint64_t prevKey = key;
for (uint32_t ii = 0; ii < _size; ++ii, prevKey = key)
{
key = keys[ii];
uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
++histogram[index];
sorted &= prevKey <= key;
uint64_t key = keys[0];
uint64_t prevKey = key;
for (uint32_t ii = 0; ii < _size; ++ii, prevKey = key)
{
key = keys[ii];
uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
++histogram[index];
sorted &= prevKey <= key;
}
}
if (sorted)

View File

@ -19,6 +19,7 @@ function toolchain(_buildDir, _libDir)
{ "asmjs", "Emscripten/asm.js" },
{ "freebsd", "FreeBSD" },
{ "linux-gcc", "Linux (GCC compiler)" },
{ "linux-gcc-5", "Linux (GCC-5 compiler)" },
{ "linux-clang", "Linux (Clang compiler)" },
{ "ios-arm", "iOS - ARM" },
{ "ios-simulator", "iOS - Simulator" },
@ -40,8 +41,9 @@ function toolchain(_buildDir, _libDir)
allowed = {
{ "vs2012-clang", "Clang 3.6" },
{ "vs2013-clang", "Clang 3.6" },
{ "vs2012-xp", "Visual Studio 2012 targeting XP" },
{ "vs2013-xp", "Visual Studio 2013 targeting XP" },
{ "vs2012-xp", "Visual Studio 2012 targeting XP" },
{ "vs2013-xp", "Visual Studio 2013 targeting XP" },
{ "vs2015-xp", "Visual Studio 2015 targeting XP" },
{ "winphone8", "Windows Phone 8.0" },
{ "winphone81", "Windows Phone 8.1" },
},
@ -110,9 +112,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
end
if "android-mips" == _OPTIONS["gcc"] then
elseif "android-mips" == _OPTIONS["gcc"] then
if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
@ -122,9 +123,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
location (path.join(_buildDir, "projects", _ACTION .. "-android-mips"))
end
if "android-x86" == _OPTIONS["gcc"] then
elseif "android-x86" == _OPTIONS["gcc"] then
if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
@ -134,9 +134,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
end
if "asmjs" == _OPTIONS["gcc"] then
elseif "asmjs" == _OPTIONS["gcc"] then
if not os.getenv("EMSCRIPTEN") then
print("Set EMSCRIPTEN enviroment variables.")
@ -147,54 +146,52 @@ function toolchain(_buildDir, _libDir)
premake.gcc.ar = "$(EMSCRIPTEN)/emar"
premake.gcc.llvm = true
location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
end
if "freebsd" == _OPTIONS["gcc"] then
elseif "freebsd" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
end
if "ios-arm" == _OPTIONS["gcc"] then
elseif "ios-arm" == _OPTIONS["gcc"] then
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm"))
end
if "ios-simulator" == _OPTIONS["gcc"] then
elseif "ios-simulator" == _OPTIONS["gcc"] then
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
end
if "linux-gcc" == _OPTIONS["gcc"] then
elseif "linux-gcc" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
end
if "linux-clang" == _OPTIONS["gcc"] then
elseif "linux-gcc-5" == _OPTIONS["gcc"] then
premake.gcc.cc = "gcc-5"
premake.gcc.cxx = "g++-5"
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
elseif "linux-clang" == _OPTIONS["gcc"] then
premake.gcc.cc = "clang"
premake.gcc.cxx = "clang++"
premake.gcc.ar = "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
end
if "mingw-gcc" == _OPTIONS["gcc"] then
elseif "mingw-gcc" == _OPTIONS["gcc"] then
premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
premake.gcc.ar = "$(MINGW)/bin/ar"
location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
end
if "mingw-clang" == _OPTIONS["gcc"] then
elseif "mingw-clang" == _OPTIONS["gcc"] then
premake.gcc.cc = "$(CLANG)/bin/clang"
premake.gcc.cxx = "$(CLANG)/bin/clang++"
premake.gcc.ar = "$(MINGW)/bin/ar"
-- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
-- premake.gcc.llvm = true
location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
end
if "nacl" == _OPTIONS["gcc"] then
elseif "nacl" == _OPTIONS["gcc"] then
if not os.getenv("NACL_SDK_ROOT") then
print("Set NACL_SDK_ROOT enviroment variables.")
@ -211,9 +208,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = naclToolchain .. "g++"
premake.gcc.ar = naclToolchain .. "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-nacl"))
end
if "nacl-arm" == _OPTIONS["gcc"] then
elseif "nacl-arm" == _OPTIONS["gcc"] then
if not os.getenv("NACL_SDK_ROOT") then
print("Set NACL_SDK_ROOT enviroment variables.")
@ -230,9 +226,9 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = naclToolchain .. "g++"
premake.gcc.ar = naclToolchain .. "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm"))
end
if "osx" == _OPTIONS["gcc"] then
elseif "osx" == _OPTIONS["gcc"] then
if os.is("linux") then
local osxToolchain = "x86_64-apple-darwin13-"
premake.gcc.cc = osxToolchain .. "clang"
@ -240,9 +236,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.ar = osxToolchain .. "ar"
end
location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
end
if "pnacl" == _OPTIONS["gcc"] then
elseif "pnacl" == _OPTIONS["gcc"] then
if not os.getenv("NACL_SDK_ROOT") then
print("Set NACL_SDK_ROOT enviroment variables.")
@ -259,9 +254,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = naclToolchain .. "clang++"
premake.gcc.ar = naclToolchain .. "ar"
location (path.join(_buildDir, "projects", _ACTION .. "-pnacl"))
end
if "qnx-arm" == _OPTIONS["gcc"] then
elseif "qnx-arm" == _OPTIONS["gcc"] then
if not os.getenv("QNX_HOST") then
print("Set QNX_HOST enviroment variables.")
@ -271,9 +265,8 @@ function toolchain(_buildDir, _libDir)
premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm"))
end
if "rpi" == _OPTIONS["gcc"] then
elseif "rpi" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
end
elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
@ -281,27 +274,27 @@ function toolchain(_buildDir, _libDir)
if (_ACTION .. "-clang") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("LLVM-" .. _ACTION)
location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
end
if "winphone8" == _OPTIONS["vs"] then
elseif "winphone8" == _OPTIONS["vs"] then
premake.vstudio.toolset = "v110_wp80"
location (path.join(_buildDir, "projects", _ACTION .. "-winphone8"))
end
if "winphone81" == _OPTIONS["vs"] then
elseif "winphone81" == _OPTIONS["vs"] then
premake.vstudio.toolset = "v120_wp81"
platforms { "ARM" }
location (path.join(_buildDir, "projects", _ACTION .. "-winphone81"))
end
if ("vs2012-xp") == _OPTIONS["vs"] then
elseif ("vs2012-xp") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("v110_xp")
location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
end
if ("vs2013-xp") == _OPTIONS["vs"] then
elseif ("vs2013-xp") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("v120_xp")
location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
elseif ("vs2015-xp") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("v140_xp")
location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
end
elseif _ACTION == "xcode4" then
@ -309,8 +302,8 @@ function toolchain(_buildDir, _libDir)
if "osx" == _OPTIONS["xcode"] then
premake.xcode.toolset = "macosx"
location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
end
if "ios" == _OPTIONS["xcode"] then
elseif "ios" == _OPTIONS["xcode"] then
premake.xcode.toolset = "iphoneos"
location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
end
@ -479,13 +472,26 @@ function toolchain(_buildDir, _libDir)
}
buildoptions { "-m64" }
configuration { "linux-gcc and not linux-clang" }
configuration { "linux-clang" }
configuration { "linux-gcc-5" }
buildoptions {
-- "-fno-omit-frame-pointer",
-- "-fsanitize=address",
-- "-fsanitize=undefined",
-- "-fsanitize=float-divide-by-zero",
-- "-fsanitize=float-cast-overflow",
}
links {
-- "asan",
-- "ubsan",
}
configuration { "linux-g*" }
buildoptions {
"-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
}
configuration { "linux-clang" }
configuration { "linux-*" }
buildoptions {
"-msse2",
@ -494,7 +500,7 @@ function toolchain(_buildDir, _libDir)
}
buildoptions_cpp {
"-std=c++0x",
}
}
links {
"rt",
"dl",
@ -503,7 +509,7 @@ function toolchain(_buildDir, _libDir)
"-Wl,--gc-sections",
}
configuration { "linux-gcc", "x32" }
configuration { "linux-g*", "x32" }
targetdir (path.join(_buildDir, "linux32_gcc/bin"))
objdir (path.join(_buildDir, "linux32_gcc/obj"))
libdirs { path.join(_libDir, "lib/linux32_gcc") }
@ -511,7 +517,7 @@ function toolchain(_buildDir, _libDir)
"-m32",
}
configuration { "linux-gcc", "x64" }
configuration { "linux-g*", "x64" }
targetdir (path.join(_buildDir, "linux64_gcc/bin"))
objdir (path.join(_buildDir, "linux64_gcc/obj"))
libdirs { path.join(_libDir, "lib/linux64_gcc") }
@ -558,7 +564,6 @@ function toolchain(_buildDir, _libDir)
}
buildoptions {
"-fPIC",
"-std=c++0x",
"-no-canonical-prefixes",
"-Wa,--noexecstack",
"-fstack-protector",
@ -567,6 +572,9 @@ function toolchain(_buildDir, _libDir)
"-Wunused-value",
"-Wundef",
}
buildoptions_cpp {
"-std=c++0x",
}
linkoptions {
"-no-canonical-prefixes",
"-Wl,--no-undefined",
@ -670,7 +678,6 @@ function toolchain(_buildDir, _libDir)
configuration { "nacl or nacl-arm or pnacl" }
buildoptions {
"-std=c++0x",
"-U__STRICT_ANSI__", -- strcasecmp, setenv, unsetenv,...
"-fno-stack-protector",
"-fdiagnostics-show-option",
@ -679,6 +686,9 @@ function toolchain(_buildDir, _libDir)
"-Wunused-value",
"-Wundef",
}
buildoptions_cpp {
"-std=c++0x",
}
includedirs {
"$(NACL_SDK_ROOT)/include",
path.join(bxDir, "include/compat/nacl"),
@ -756,7 +766,7 @@ function toolchain(_buildDir, _libDir)
configuration { "osx", "x32" }
targetdir (path.join(_buildDir, "osx32_clang/bin"))
objdir (path.join(_buildDir, "osx32_clang/obj"))
libdirs { path.join(_libDir, "lib/osx32_clang") }
--libdirs { path.join(_libDir, "lib/osx32_clang") }
buildoptions {
"-m32",
}
@ -764,7 +774,7 @@ function toolchain(_buildDir, _libDir)
configuration { "osx", "x64" }
targetdir (path.join(_buildDir, "osx64_clang/bin"))
objdir (path.join(_buildDir, "osx64_clang/obj"))
libdirs { path.join(_libDir, "lib/osx64_clang") }
--libdirs { path.join(_libDir, "lib/osx64_clang") }
buildoptions {
"-m64",
}
@ -831,11 +841,13 @@ function toolchain(_buildDir, _libDir)
libdirs { path.join(_libDir, "lib/qnx-arm") }
-- includedirs { path.join(bxDir, "include/compat/qnx") }
buildoptions {
"-std=c++0x",
"-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
"-Wunused-value",
"-Wundef",
}
buildoptions_cpp {
"-std=c++0x",
}
configuration { "rpi" }
targetdir (path.join(_buildDir, "rpi/bin"))

View File

@ -29,10 +29,11 @@
#include <tinystl/allocator.h>
#include <tinystl/unordered_map.h>
struct Foo { int bar; };
TEST(uomap_nonpod_compiles) {
struct Foo { int bar; };
// verify this compiles
typedef tinystl::unordered_map<int, Foo> map;
map m;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,10 +1,2 @@
bin
build/*/obj
scripts/obj
*.sln
*.suo
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.opensdf
*.sdf

View File

@ -14,7 +14,7 @@ Supported project generators:
Download (stable)
-----------------
version 225 (commit 2321131cbf61d5a13df44c255b8d18d73121149d)
version 257 (commit 77931cf939ad4ec1bacb1fe92045012fd1e25eba)
Linux:
https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie
@ -50,7 +50,7 @@ intention to keep it compatible with it.
- Added search for default script. Default script name is changed to genie.lua
(solution.lua and premake4.lua are also allowed), and it can be located in
`scripts` directory.
- Updated Lua from 5.1.4 to 5.2.3.
- Updated Lua from 5.1.4 to 5.3.0.
- Disabled `SmallerTypeCheck` VS option when `ExtraWarnings` is set (need to
move it into separate option).
- New versioning scheme based on revision number from git.
@ -73,6 +73,11 @@ intention to keep it compatible with it.
- Added `msgcompile`, `msgresource`, `msglinking` and `msgarchiving` as
overrides for make messages.
- Added `messageskip` list to disable some of compiler messages.
- Added `buildoptions_c`, `buildoptions_cpp`, `buildoptions_objc` for
configuring language specific build options.
- Split functionality of `excludes` in `removefiles` and `excludes`. With VS
`excludes` will exclude files from build but files will be added to project
file. `removefiles` removes files completely from project.
## Why fork?
@ -112,7 +117,7 @@ state of Premake, it's just acknowledging the problem, and dealing with it.
GENie
Copyright (c) 2014 Branimir Karadžić, Neil Richardson, Mike Popoloski,
Drew Solomon, Ted de Munnik, Miodrag Milanović.
Drew Solomon, Ted de Munnik, Miodrag Milanović, Brett Vickers.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,

View File

@ -42,7 +42,7 @@ ifeq ($(config),release)
TARGETDIR = ../../bin/darwin
override TARGET = $(TARGETDIR)/genie
DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os -mmacosx-version-min=10.4
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os -mmacosx-version-min=10.4
@ -53,57 +53,59 @@ ifeq ($(config),release)
LIBS += $(LDDEPS) -framework CoreServices
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -118,7 +120,7 @@ ifeq ($(config),debug)
TARGETDIR = ../../bin/darwin
override TARGET = $(TARGETDIR)/genie
DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g -mmacosx-version-min=10.4
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g -mmacosx-version-min=10.4
@ -129,57 +131,59 @@ ifeq ($(config),debug)
LIBS += $(LDDEPS) -framework CoreServices
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -194,7 +198,7 @@ ifeq ($(config),releaseuniv32)
TARGETDIR = ../../bin/darwin
override TARGET = $(TARGETDIR)/genie
DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os -arch i386 -arch ppc -mmacosx-version-min=10.4
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os -arch i386 -arch ppc -mmacosx-version-min=10.4
@ -205,57 +209,59 @@ ifeq ($(config),releaseuniv32)
LIBS += $(LDDEPS) -framework CoreServices
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -270,7 +276,7 @@ ifeq ($(config),debuguniv32)
TARGETDIR = ../../bin/darwin
override TARGET = $(TARGETDIR)/genie
DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g -arch i386 -arch ppc -mmacosx-version-min=10.4
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g -arch i386 -arch ppc -mmacosx-version-min=10.4
@ -281,57 +287,59 @@ ifeq ($(config),debuguniv32)
LIBS += $(LDDEPS) -framework CoreServices
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -344,7 +352,7 @@ endif
OBJDIRS := \
$(OBJDIR) \
$(OBJDIR)/src/host \
$(OBJDIR)/src/host/lua-5.2.3/src \
$(OBJDIR)/src/host/lua-5.3.0/src \
RESOURCES := \
@ -363,7 +371,7 @@ $(TARGETDIR):
-$(call MKDIR,$(TARGETDIR))
$(OBJDIRS):
@echo Creating $(OBJDIR)
@echo Creating $(@)
-$(call MKDIR,$@)
clean:
@ -388,7 +396,7 @@ $(GCH): $(PCH)
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
endif
$(OBJDIR)/src/host/os_getcwd.o: ../../src/host/os_getcwd.c
$(OBJDIR)/src/host/os_mkdir.o: ../../src/host/os_mkdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
@ -396,15 +404,63 @@ $(OBJDIR)/src/host/os_stat.o: ../../src/host/os_stat.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_isdir.o: ../../src/host/os_isdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_rmdir.o: ../../src/host/os_rmdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_uuid.o: ../../src/host/os_uuid.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_endswith.o: ../../src/host/string_endswith.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_chdir.o: ../../src/host/os_chdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getversion.o: ../../src/host/os_getversion.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/path_isabsolute.o: ../../src/host/path_isabsolute.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/scripts.o: ../../src/host/scripts.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake.o: ../../src/host/premake.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getcwd.o: ../../src/host/os_getcwd.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake_main.o: ../../src/host/premake_main.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_uuid.o: ../../src/host/os_uuid.c
$(OBJDIR)/src/host/os_ticks.o: ../../src/host/os_ticks.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_hash.o: ../../src/host/string_hash.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_is64bit.o: ../../src/host/os_is64bit.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_match.o: ../../src/host/os_match.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
@ -416,179 +472,139 @@ $(OBJDIR)/src/host/os_copyfile.o: ../../src/host/os_copyfile.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/scripts.o: ../../src/host/scripts.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_endswith.o: ../../src/host/string_endswith.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getversion.o: ../../src/host/os_getversion.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_hash.o: ../../src/host/string_hash.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_pathsearch.o: ../../src/host/os_pathsearch.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_rmdir.o: ../../src/host/os_rmdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o: ../../src/host/lua-5.3.0/src/lobject.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_match.o: ../../src/host/os_match.c
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o: ../../src/host/lua-5.3.0/src/lparser.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake.o: ../../src/host/premake.c
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o: ../../src/host/lua-5.3.0/src/lundump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_isdir.o: ../../src/host/os_isdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o: ../../src/host/lua-5.3.0/src/lfunc.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_mkdir.o: ../../src/host/os_mkdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o: ../../src/host/lua-5.3.0/src/lcorolib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/path_isabsolute.o: ../../src/host/path_isabsolute.c
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o: ../../src/host/lua-5.3.0/src/liolib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_is64bit.o: ../../src/host/os_is64bit.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o: ../../src/host/lua-5.3.0/src/ltablib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o: ../../src/host/lua-5.2.3/src/ldump.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o: ../../src/host/lua-5.3.0/src/ldblib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o: ../../src/host/lua-5.2.3/src/lvm.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o: ../../src/host/lua-5.3.0/src/ldebug.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o: ../../src/host/lua-5.2.3/src/ltable.c
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o: ../../src/host/lua-5.3.0/src/lmathlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o: ../../src/host/lua-5.2.3/src/lstrlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o: ../../src/host/lua-5.3.0/src/lctype.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o: ../../src/host/lua-5.2.3/src/liolib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o: ../../src/host/lua-5.3.0/src/lutf8lib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o: ../../src/host/lua-5.2.3/src/lcode.c
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o: ../../src/host/lua-5.3.0/src/lauxlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o: ../../src/host/lua-5.2.3/src/lparser.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o: ../../src/host/lua-5.3.0/src/lstate.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o: ../../src/host/lua-5.2.3/src/loadlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o: ../../src/host/lua-5.3.0/src/lgc.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o: ../../src/host/lua-5.2.3/src/lbitlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o: ../../src/host/lua-5.3.0/src/ltable.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o: ../../src/host/lua-5.2.3/src/lzio.c
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o: ../../src/host/lua-5.3.0/src/lbitlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o: ../../src/host/lua-5.2.3/src/ldblib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o: ../../src/host/lua-5.3.0/src/lapi.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o: ../../src/host/lua-5.2.3/src/lmathlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o: ../../src/host/lua-5.3.0/src/lmem.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o: ../../src/host/lua-5.2.3/src/lfunc.c
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o: ../../src/host/lua-5.3.0/src/lvm.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o: ../../src/host/lua-5.2.3/src/lmem.c
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o: ../../src/host/lua-5.3.0/src/lcode.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o: ../../src/host/lua-5.2.3/src/lgc.c
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o: ../../src/host/lua-5.3.0/src/lzio.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o: ../../src/host/lua-5.2.3/src/lstring.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o: ../../src/host/lua-5.3.0/src/lstrlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o: ../../src/host/lua-5.2.3/src/linit.c
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o: ../../src/host/lua-5.3.0/src/lbaselib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o: ../../src/host/lua-5.2.3/src/ltm.c
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o: ../../src/host/lua-5.3.0/src/linit.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o: ../../src/host/lua-5.2.3/src/lapi.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o: ../../src/host/lua-5.3.0/src/ldo.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o: ../../src/host/lua-5.2.3/src/lctype.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o: ../../src/host/lua-5.3.0/src/lstring.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o: ../../src/host/lua-5.2.3/src/lstate.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o: ../../src/host/lua-5.3.0/src/ldump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o: ../../src/host/lua-5.2.3/src/lbaselib.c
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o: ../../src/host/lua-5.3.0/src/llex.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o: ../../src/host/lua-5.2.3/src/ltablib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o: ../../src/host/lua-5.3.0/src/lopcodes.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o: ../../src/host/lua-5.2.3/src/lauxlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o: ../../src/host/lua-5.3.0/src/loslib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o: ../../src/host/lua-5.2.3/src/lcorolib.c
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o: ../../src/host/lua-5.3.0/src/loadlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o: ../../src/host/lua-5.2.3/src/llex.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o: ../../src/host/lua-5.2.3/src/ldo.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o: ../../src/host/lua-5.2.3/src/lundump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o: ../../src/host/lua-5.2.3/src/lopcodes.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o: ../../src/host/lua-5.2.3/src/loslib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o: ../../src/host/lua-5.2.3/src/lobject.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o: ../../src/host/lua-5.2.3/src/ldebug.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o: ../../src/host/lua-5.3.0/src/ltm.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

View File

@ -42,7 +42,7 @@ ifeq ($(config),release)
TARGETDIR = ../../bin/linux
override TARGET = $(TARGETDIR)/genie
DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_POSIX -DLUA_USE_DLOPEN
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
@ -53,57 +53,59 @@ ifeq ($(config),release)
LIBS += $(LDDEPS) -ldl -lm
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -118,7 +120,7 @@ ifeq ($(config),debug)
TARGETDIR = ../../bin/linux
override TARGET = $(TARGETDIR)/genie
DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_POSIX -DLUA_USE_DLOPEN
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g
@ -129,57 +131,59 @@ ifeq ($(config),debug)
LIBS += $(LDDEPS) -ldl -lm
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -191,8 +195,8 @@ endif
OBJDIRS := \
$(OBJDIR) \
$(OBJDIR)/src/host/lua-5.2.3/src \
$(OBJDIR)/src/host \
$(OBJDIR)/src/host/lua-5.3.0/src \
RESOURCES := \
@ -211,7 +215,7 @@ $(TARGETDIR):
-$(call MKDIR,$(TARGETDIR))
$(OBJDIRS):
@echo Creating $(OBJDIR)
@echo Creating $(@)
-$(call MKDIR,$@)
clean:
@ -236,7 +240,7 @@ $(GCH): $(PCH)
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
endif
$(OBJDIR)/src/host/os_getcwd.o: ../../src/host/os_getcwd.c
$(OBJDIR)/src/host/os_mkdir.o: ../../src/host/os_mkdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
@ -244,15 +248,63 @@ $(OBJDIR)/src/host/os_stat.o: ../../src/host/os_stat.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_isdir.o: ../../src/host/os_isdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_rmdir.o: ../../src/host/os_rmdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_uuid.o: ../../src/host/os_uuid.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_endswith.o: ../../src/host/string_endswith.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_chdir.o: ../../src/host/os_chdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getversion.o: ../../src/host/os_getversion.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/path_isabsolute.o: ../../src/host/path_isabsolute.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/scripts.o: ../../src/host/scripts.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake.o: ../../src/host/premake.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getcwd.o: ../../src/host/os_getcwd.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake_main.o: ../../src/host/premake_main.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_uuid.o: ../../src/host/os_uuid.c
$(OBJDIR)/src/host/os_ticks.o: ../../src/host/os_ticks.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_hash.o: ../../src/host/string_hash.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_is64bit.o: ../../src/host/os_is64bit.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_match.o: ../../src/host/os_match.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
@ -264,179 +316,139 @@ $(OBJDIR)/src/host/os_copyfile.o: ../../src/host/os_copyfile.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/scripts.o: ../../src/host/scripts.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_endswith.o: ../../src/host/string_endswith.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getversion.o: ../../src/host/os_getversion.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_hash.o: ../../src/host/string_hash.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_pathsearch.o: ../../src/host/os_pathsearch.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_rmdir.o: ../../src/host/os_rmdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o: ../../src/host/lua-5.3.0/src/lobject.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_match.o: ../../src/host/os_match.c
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o: ../../src/host/lua-5.3.0/src/lparser.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake.o: ../../src/host/premake.c
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o: ../../src/host/lua-5.3.0/src/lundump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_isdir.o: ../../src/host/os_isdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o: ../../src/host/lua-5.3.0/src/lfunc.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_mkdir.o: ../../src/host/os_mkdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o: ../../src/host/lua-5.3.0/src/lcorolib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/path_isabsolute.o: ../../src/host/path_isabsolute.c
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o: ../../src/host/lua-5.3.0/src/liolib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_is64bit.o: ../../src/host/os_is64bit.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o: ../../src/host/lua-5.3.0/src/ltablib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o: ../../src/host/lua-5.2.3/src/ldump.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o: ../../src/host/lua-5.3.0/src/ldblib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o: ../../src/host/lua-5.2.3/src/lvm.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o: ../../src/host/lua-5.3.0/src/ldebug.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o: ../../src/host/lua-5.2.3/src/ltable.c
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o: ../../src/host/lua-5.3.0/src/lmathlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o: ../../src/host/lua-5.2.3/src/lstrlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o: ../../src/host/lua-5.3.0/src/lctype.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o: ../../src/host/lua-5.2.3/src/liolib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o: ../../src/host/lua-5.3.0/src/lutf8lib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o: ../../src/host/lua-5.2.3/src/lcode.c
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o: ../../src/host/lua-5.3.0/src/lauxlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o: ../../src/host/lua-5.2.3/src/lparser.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o: ../../src/host/lua-5.3.0/src/lstate.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o: ../../src/host/lua-5.2.3/src/loadlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o: ../../src/host/lua-5.3.0/src/lgc.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o: ../../src/host/lua-5.2.3/src/lbitlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o: ../../src/host/lua-5.3.0/src/ltable.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o: ../../src/host/lua-5.2.3/src/lzio.c
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o: ../../src/host/lua-5.3.0/src/lbitlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o: ../../src/host/lua-5.2.3/src/ldblib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o: ../../src/host/lua-5.3.0/src/lapi.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o: ../../src/host/lua-5.2.3/src/lmathlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o: ../../src/host/lua-5.3.0/src/lmem.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o: ../../src/host/lua-5.2.3/src/lfunc.c
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o: ../../src/host/lua-5.3.0/src/lvm.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o: ../../src/host/lua-5.2.3/src/lmem.c
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o: ../../src/host/lua-5.3.0/src/lcode.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o: ../../src/host/lua-5.2.3/src/lgc.c
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o: ../../src/host/lua-5.3.0/src/lzio.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o: ../../src/host/lua-5.2.3/src/lstring.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o: ../../src/host/lua-5.3.0/src/lstrlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o: ../../src/host/lua-5.2.3/src/linit.c
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o: ../../src/host/lua-5.3.0/src/lbaselib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o: ../../src/host/lua-5.2.3/src/ltm.c
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o: ../../src/host/lua-5.3.0/src/linit.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o: ../../src/host/lua-5.2.3/src/lapi.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o: ../../src/host/lua-5.3.0/src/ldo.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o: ../../src/host/lua-5.2.3/src/lctype.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o: ../../src/host/lua-5.3.0/src/lstring.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o: ../../src/host/lua-5.2.3/src/lstate.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o: ../../src/host/lua-5.3.0/src/ldump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o: ../../src/host/lua-5.2.3/src/lbaselib.c
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o: ../../src/host/lua-5.3.0/src/llex.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o: ../../src/host/lua-5.2.3/src/ltablib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o: ../../src/host/lua-5.3.0/src/lopcodes.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o: ../../src/host/lua-5.2.3/src/lauxlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o: ../../src/host/lua-5.3.0/src/loslib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o: ../../src/host/lua-5.2.3/src/lcorolib.c
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o: ../../src/host/lua-5.3.0/src/loadlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o: ../../src/host/lua-5.2.3/src/llex.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o: ../../src/host/lua-5.2.3/src/ldo.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o: ../../src/host/lua-5.2.3/src/lundump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o: ../../src/host/lua-5.2.3/src/lopcodes.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o: ../../src/host/lua-5.2.3/src/loslib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o: ../../src/host/lua-5.2.3/src/lobject.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o: ../../src/host/lua-5.2.3/src/ldebug.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o: ../../src/host/lua-5.3.0/src/ltm.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

View File

@ -42,7 +42,7 @@ ifeq ($(config),release)
TARGETDIR = ../../bin/windows
override TARGET = $(TARGETDIR)/genie.exe
DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
@ -53,57 +53,59 @@ ifeq ($(config),release)
LIBS += $(LDDEPS) -lole32
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -118,7 +120,7 @@ ifeq ($(config),debug)
TARGETDIR = ../../bin/windows
override TARGET = $(TARGETDIR)/genie.exe
DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE
INCLUDES += -I../../src/host/lua-5.2.3/src
INCLUDES += -I../../src/host/lua-5.3.0/src
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g
ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g
@ -129,57 +131,59 @@ ifeq ($(config),debug)
LIBS += $(LDDEPS) -lole32
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)
OBJECTS := \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/os_stat.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_uuid.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_chdir.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_getcwd.o \
$(OBJDIR)/src/host/premake_main.o \
$(OBJDIR)/src/host/os_ticks.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/os_isfile.o \
$(OBJDIR)/src/host/os_copyfile.o \
$(OBJDIR)/src/host/scripts.o \
$(OBJDIR)/src/host/string_endswith.o \
$(OBJDIR)/src/host/os_getversion.o \
$(OBJDIR)/src/host/string_hash.o \
$(OBJDIR)/src/host/os_pathsearch.o \
$(OBJDIR)/src/host/os_rmdir.o \
$(OBJDIR)/src/host/os_match.o \
$(OBJDIR)/src/host/premake.o \
$(OBJDIR)/src/host/os_isdir.o \
$(OBJDIR)/src/host/os_mkdir.o \
$(OBJDIR)/src/host/path_isabsolute.o \
$(OBJDIR)/src/host/os_is64bit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o \
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o \
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o \
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o \
define PREBUILDCMDS
endef
@ -191,8 +195,8 @@ endif
OBJDIRS := \
$(OBJDIR) \
$(OBJDIR)/src/host/lua-5.3.0/src \
$(OBJDIR)/src/host \
$(OBJDIR)/src/host/lua-5.2.3/src \
RESOURCES := \
@ -211,7 +215,7 @@ $(TARGETDIR):
-$(call MKDIR,$(TARGETDIR))
$(OBJDIRS):
@echo Creating $(OBJDIR)
@echo Creating $(@)
-$(call MKDIR,$@)
clean:
@ -236,7 +240,7 @@ $(GCH): $(PCH)
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
endif
$(OBJDIR)/src/host/os_getcwd.o: ../../src/host/os_getcwd.c
$(OBJDIR)/src/host/os_mkdir.o: ../../src/host/os_mkdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
@ -244,15 +248,63 @@ $(OBJDIR)/src/host/os_stat.o: ../../src/host/os_stat.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_isdir.o: ../../src/host/os_isdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_rmdir.o: ../../src/host/os_rmdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_uuid.o: ../../src/host/os_uuid.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_endswith.o: ../../src/host/string_endswith.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_chdir.o: ../../src/host/os_chdir.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getversion.o: ../../src/host/os_getversion.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/path_isabsolute.o: ../../src/host/path_isabsolute.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/scripts.o: ../../src/host/scripts.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake.o: ../../src/host/premake.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getcwd.o: ../../src/host/os_getcwd.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake_main.o: ../../src/host/premake_main.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_uuid.o: ../../src/host/os_uuid.c
$(OBJDIR)/src/host/os_ticks.o: ../../src/host/os_ticks.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_hash.o: ../../src/host/string_hash.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_is64bit.o: ../../src/host/os_is64bit.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_match.o: ../../src/host/os_match.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
@ -264,179 +316,139 @@ $(OBJDIR)/src/host/os_copyfile.o: ../../src/host/os_copyfile.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/scripts.o: ../../src/host/scripts.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_endswith.o: ../../src/host/string_endswith.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_getversion.o: ../../src/host/os_getversion.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/string_hash.o: ../../src/host/string_hash.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_pathsearch.o: ../../src/host/os_pathsearch.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_rmdir.o: ../../src/host/os_rmdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lobject.o: ../../src/host/lua-5.3.0/src/lobject.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_match.o: ../../src/host/os_match.c
$(OBJDIR)/src/host/lua-5.3.0/src/lparser.o: ../../src/host/lua-5.3.0/src/lparser.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/premake.o: ../../src/host/premake.c
$(OBJDIR)/src/host/lua-5.3.0/src/lundump.o: ../../src/host/lua-5.3.0/src/lundump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_isdir.o: ../../src/host/os_isdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lfunc.o: ../../src/host/lua-5.3.0/src/lfunc.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_mkdir.o: ../../src/host/os_mkdir.c
$(OBJDIR)/src/host/lua-5.3.0/src/lcorolib.o: ../../src/host/lua-5.3.0/src/lcorolib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/path_isabsolute.o: ../../src/host/path_isabsolute.c
$(OBJDIR)/src/host/lua-5.3.0/src/liolib.o: ../../src/host/lua-5.3.0/src/liolib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/os_is64bit.o: ../../src/host/os_is64bit.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltablib.o: ../../src/host/lua-5.3.0/src/ltablib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldump.o: ../../src/host/lua-5.2.3/src/ldump.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldblib.o: ../../src/host/lua-5.3.0/src/ldblib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lvm.o: ../../src/host/lua-5.2.3/src/lvm.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldebug.o: ../../src/host/lua-5.3.0/src/ldebug.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltable.o: ../../src/host/lua-5.2.3/src/ltable.c
$(OBJDIR)/src/host/lua-5.3.0/src/lmathlib.o: ../../src/host/lua-5.3.0/src/lmathlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o: ../../src/host/lua-5.2.3/src/lstrlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lctype.o: ../../src/host/lua-5.3.0/src/lctype.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/liolib.o: ../../src/host/lua-5.2.3/src/liolib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lutf8lib.o: ../../src/host/lua-5.3.0/src/lutf8lib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lcode.o: ../../src/host/lua-5.2.3/src/lcode.c
$(OBJDIR)/src/host/lua-5.3.0/src/lauxlib.o: ../../src/host/lua-5.3.0/src/lauxlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lparser.o: ../../src/host/lua-5.2.3/src/lparser.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstate.o: ../../src/host/lua-5.3.0/src/lstate.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o: ../../src/host/lua-5.2.3/src/loadlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lgc.o: ../../src/host/lua-5.3.0/src/lgc.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o: ../../src/host/lua-5.2.3/src/lbitlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltable.o: ../../src/host/lua-5.3.0/src/ltable.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lzio.o: ../../src/host/lua-5.2.3/src/lzio.c
$(OBJDIR)/src/host/lua-5.3.0/src/lbitlib.o: ../../src/host/lua-5.3.0/src/lbitlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o: ../../src/host/lua-5.2.3/src/ldblib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lapi.o: ../../src/host/lua-5.3.0/src/lapi.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o: ../../src/host/lua-5.2.3/src/lmathlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lmem.o: ../../src/host/lua-5.3.0/src/lmem.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o: ../../src/host/lua-5.2.3/src/lfunc.c
$(OBJDIR)/src/host/lua-5.3.0/src/lvm.o: ../../src/host/lua-5.3.0/src/lvm.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lmem.o: ../../src/host/lua-5.2.3/src/lmem.c
$(OBJDIR)/src/host/lua-5.3.0/src/lcode.o: ../../src/host/lua-5.3.0/src/lcode.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lgc.o: ../../src/host/lua-5.2.3/src/lgc.c
$(OBJDIR)/src/host/lua-5.3.0/src/lzio.o: ../../src/host/lua-5.3.0/src/lzio.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstring.o: ../../src/host/lua-5.2.3/src/lstring.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstrlib.o: ../../src/host/lua-5.3.0/src/lstrlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/linit.o: ../../src/host/lua-5.2.3/src/linit.c
$(OBJDIR)/src/host/lua-5.3.0/src/lbaselib.o: ../../src/host/lua-5.3.0/src/lbaselib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltm.o: ../../src/host/lua-5.2.3/src/ltm.c
$(OBJDIR)/src/host/lua-5.3.0/src/linit.o: ../../src/host/lua-5.3.0/src/linit.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lapi.o: ../../src/host/lua-5.2.3/src/lapi.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldo.o: ../../src/host/lua-5.3.0/src/ldo.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lctype.o: ../../src/host/lua-5.2.3/src/lctype.c
$(OBJDIR)/src/host/lua-5.3.0/src/lstring.o: ../../src/host/lua-5.3.0/src/lstring.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lstate.o: ../../src/host/lua-5.2.3/src/lstate.c
$(OBJDIR)/src/host/lua-5.3.0/src/ldump.o: ../../src/host/lua-5.3.0/src/ldump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o: ../../src/host/lua-5.2.3/src/lbaselib.c
$(OBJDIR)/src/host/lua-5.3.0/src/llex.o: ../../src/host/lua-5.3.0/src/llex.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o: ../../src/host/lua-5.2.3/src/ltablib.c
$(OBJDIR)/src/host/lua-5.3.0/src/lopcodes.o: ../../src/host/lua-5.3.0/src/lopcodes.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o: ../../src/host/lua-5.2.3/src/lauxlib.c
$(OBJDIR)/src/host/lua-5.3.0/src/loslib.o: ../../src/host/lua-5.3.0/src/loslib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o: ../../src/host/lua-5.2.3/src/lcorolib.c
$(OBJDIR)/src/host/lua-5.3.0/src/loadlib.o: ../../src/host/lua-5.3.0/src/loadlib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/llex.o: ../../src/host/lua-5.2.3/src/llex.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldo.o: ../../src/host/lua-5.2.3/src/ldo.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lundump.o: ../../src/host/lua-5.2.3/src/lundump.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o: ../../src/host/lua-5.2.3/src/lopcodes.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/loslib.o: ../../src/host/lua-5.2.3/src/loslib.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/lobject.o: ../../src/host/lua-5.2.3/src/lobject.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o: ../../src/host/lua-5.2.3/src/ldebug.c
$(OBJDIR)/src/host/lua-5.3.0/src/ltm.o: ../../src/host/lua-5.3.0/src/ltm.c
@echo $(notdir $<)
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

View File

@ -26,7 +26,7 @@
"StaticRuntime"
}
includedirs {
"../src/host/lua-5.2.3/src"
"../src/host/lua-5.3.0/src"
}
files {
@ -36,12 +36,12 @@
"../src/host/scripts.c",
}
removefiles {
excludes {
"../src/premake.lua",
"../src/host/lua-5.2.3/src/lua.c",
"../src/host/lua-5.2.3/src/luac.c",
"../src/host/lua-5.2.3/**.lua",
"../src/host/lua-5.2.3/etc/*.c",
"../src/host/lua-5.3.0/src/lua.c",
"../src/host/lua-5.3.0/src/luac.c",
"../src/host/lua-5.3.0/**.lua",
"../src/host/lua-5.3.0/etc/*.c",
}
configuration "Debug"

View File

@ -73,20 +73,20 @@
_p('endef')
_p('')
end
-- target build rule
_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
if prj.kind == "StaticLib" then
if prj.kind == "StaticLib" then
if prj.msgarchiving then
_p('\t@echo ' .. prj.msgarchiving)
else
_p('\t@echo Archiving %s', prj.name)
end
if (not prj.archivesplit_size) then
end
if (not prj.archivesplit_size) then
prj.archivesplit_size=200
end
if (not prj.options.ArchiveSplit) then
if (not prj.options.ArchiveSplit) then
_p('\t$(SILENT) $(LINKCMD) $(OBJECTS)')
else
_p('\t$(call RM,$(TARGET))')
@ -98,7 +98,7 @@
_p('\t@echo ' .. prj.msglinking)
else
_p('\t@echo Linking %s', prj.name)
end
end
_p('\t$(SILENT) $(LINKCMD)')
end
_p('\t$(POSTBUILDCMDS)')
@ -111,7 +111,7 @@
_p('$(OBJDIRS):')
if (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, "SkipCreatingMessage")) then
_p('\t@echo Creating $(OBJDIR)')
_p('\t@echo Creating $(@)')
end
_p('\t-$(call MKDIR,$@)')
_p('')
@ -246,14 +246,8 @@
for _, file in ipairs(prj.files) do
if path.iscppfile(file) then
-- check if file is excluded.
local excluded = false
for _, exclude in ipairs(cfg.excludes) do
excluded = (exclude == file)
if (excluded) then break end
end
-- if not excluded, add it.
if excluded == false then
if not table.icontains(cfg.excludes, file) then
-- if not excluded, add it.
_p('\t$(OBJDIR)/%s.o \\'
, _MAKE.esc(path.trimdots(path.removeext(file)))
)

View File

@ -477,22 +477,10 @@
vc2010.link(cfg)
event_hooks(cfg)
_p(1,'</ItemDefinitionGroup>')
end
end
function exists(table, fine)
for _, value in ipairs(table) do
if value == find then return true end
end
return false
end
--
-- Retrieve a list of files for a particular build group, one of
-- "ClInclude", "ClCompile", "ResourceCompile", and "None".
@ -506,7 +494,7 @@
ClInclude = {},
None = {},
ResourceCompile = {},
AppxManifest = {}
AppxManifest = {}
}
local foundAppxManifest = false
@ -514,19 +502,19 @@
if path.iscppfile(file.name) then
table.insert(sortedfiles.ClCompile, file)
elseif path.iscppheader(file.name) then
if not exists(prj.removefiles, file) then
if not table.icontains(prj.removefiles, file) then
table.insert(sortedfiles.ClInclude, file)
end
elseif path.isresourcefile(file.name) then
table.insert(sortedfiles.ResourceCompile, file)
else
local ext = path.getextension(file.name):lower()
if ext == ".appxmanifest" then
local ext = path.getextension(file.name):lower()
if ext == ".appxmanifest" then
foundAppxManifest = true
table.insert(sortedfiles.AppxManifest, file)
else
table.insert(sortedfiles.None, file)
end
table.insert(sortedfiles.AppxManifest, file)
else
table.insert(sortedfiles.None, file)
end
end
end
@ -557,7 +545,7 @@
vc2010.compilerfilesgroup(prj)
vc2010.simplefilesgroup(prj, "None")
vc2010.simplefilesgroup(prj, "ResourceCompile")
vc2010.simplefilesgroup(prj, "AppxManifest")
vc2010.simplefilesgroup(prj, "AppxManifest")
end
@ -566,13 +554,13 @@
if #files > 0 then
_p(1,'<ItemGroup>')
for _, file in ipairs(files) do
if subtype then
_p(2,'<%s Include=\"%s\">', section, path.translate(file.name, "\\"))
_p(3,'<SubType>%s</SubType>', subtype)
_p(2,'</%s>', section)
else
_p(2,'<%s Include=\"%s\" />', section, path.translate(file.name, "\\"))
end
if subtype then
_p(2,'<%s Include=\"%s\">', section, path.translate(file.name, "\\"))
_p(3,'<SubType>%s</SubType>', subtype)
_p(2,'</%s>', section)
else
_p(2,'<%s Include=\"%s\" />', section, path.translate(file.name, "\\"))
end
end
_p(1,'</ItemGroup>')
end
@ -605,37 +593,15 @@
end
end
-- Global exclude
local excluded = false
for _, exclude in ipairs(prj.excludes) do
if exclude == file.name then
for _, vsconfig in ipairs(configs) do
local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)
_p(3, '<ExcludedFromBuild '
.. if_config_and_platform()
.. '>true</ExcludedFromBuild>'
, premake.esc(vsconfig.name)
)
end
excluded = true
break
end
end
if not excluded then
-- Per configuration excludes
for _, vsconfig in ipairs(configs) do
local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)
for _, exclude in ipairs(cfg.excludes) do
if exclude == file.name then
_p(3, '<ExcludedFromBuild '
.. if_config_and_platform()
.. '>true</ExcludedFromBuild>'
, premake.esc(vsconfig.name)
)
end
end
local excluded = table.icontains(prj.excludes, file.name)
for _, vsconfig in ipairs(configs) do
local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)
if excluded or table.icontains(cfg.excludes, file.name) then
_p(3, '<ExcludedFromBuild '
.. if_config_and_platform()
.. '>true</ExcludedFromBuild>'
, premake.esc(vsconfig.name)
)
end
end

View File

@ -810,13 +810,16 @@
end
-- list value types get a remove() call too
if info.kind == "list" or
info.kind == "dirlist" or
info.kind == "filelist" or
info.kind == "absolutefilelist"
if info.kind == "list"
or info.kind == "dirlist"
or info.kind == "filelist"
or info.kind == "absolutefilelist"
then
_G["remove"..name] = function(value)
premake.remove(name, value)
if name ~= "removefiles"
and name ~= "files" then
_G["remove"..name] = function(value)
premake.remove(name, value)
end
end
end
end

View File

@ -253,6 +253,7 @@
-- build the configuration base by merging the solution and project level settings
local cfg = {}
mergeobject(cfg, basis[key])
adjustpaths(obj.location, cfg)
mergeobject(cfg, obj)
@ -376,7 +377,7 @@
local dir
local start = iif(cfg.name, 2, 1)
for v = start, iif(cfg.flags.SingleOutputDir,num_variations-1,num_variations) do
for v = start, iif(cfg.flags.SingleOutputDir==true,num_variations-1,num_variations) do
dir = cfg_dirs[cfg][v]
if hit_counts[dir] == 1 then break end
end
@ -701,15 +702,13 @@
end
-- remove excluded files from the file list
local files = { }
local removefiles = cfg.removefiles
if _ACTION == 'gmake' then
removefiles = table.join(removefiles, cfg.excludes)
end
local files = {}
for _, fname in ipairs(cfg.files) do
local removed = false
for _, removefname in ipairs(cfg.removefiles) do
removed = (fname == removefname)
if (removed) then break end
end
if (not removed) then
if not table.icontains(removefiles, fname) then
table.insert(files, fname)
end
end
@ -725,21 +724,9 @@
end
-- build configuration objects for all files
-- TODO: can I build this as a tree instead, and avoid the extra
-- step of building it later?
cfg.__fileconfigs = { }
for _, fname in ipairs(cfg.files) do
cfg.terms.required = fname:lower()
local fcfg = {}
for _, blk in ipairs(cfg.project.blocks) do
if (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then
mergeobject(fcfg, blk)
end
end
-- add indexed by name and integer
-- TODO: when everything is converted to trees I won't need
-- to index by name any longer
local fcfg = { }
fcfg.name = fname
cfg.__fileconfigs[fname] = fcfg
table.insert(cfg.__fileconfigs, fcfg)

View File

@ -283,7 +283,9 @@ function inspect(rootObject, options)
end
function printtable(name, table)
print("--- " .. name)
print(inspect(table))
print("---")
print("table: ", name, inspect(table), "\n")
end
function printstack()
print(debug.traceback(), "\n")
end

View File

@ -3,22 +3,27 @@
-- Additions to Lua's built-in table functions.
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
--
--
-- Returns true if the table contains the specified value.
--
function table.contains(t, value)
for _,v in pairs(t) do
if (v == value) then
return true
end
for _, v in pairs(t) do
if v == value then return true end
end
return false
end
function table.icontains(t, value)
for _, v in ipairs(t) do
if v == value then return true end
end
return false
end
--
-- Enumerates an array of objects and returns a new table containing
-- only the value of one particular field.
@ -31,8 +36,8 @@
end
return result
end
--
-- Flattens a hierarchy of tables into a single array containing all
@ -41,7 +46,7 @@
function table.flatten(arr)
local result = { }
local function flatten(arr)
for _, v in ipairs(arr) do
if type(v) == "table" then
@ -51,7 +56,7 @@
end
end
end
flatten(arr)
return result
end
@ -75,7 +80,7 @@
--
-- Inserts a value of array of values into a table. If the value is
-- itself a table, its contents are enumerated and added instead. So
-- itself a table, its contents are enumerated and added instead. So
-- these inputs give these outputs:
--
-- "x" -> { "x" }
@ -156,7 +161,7 @@
end
return result
end
--
@ -179,5 +184,5 @@
end
return result
end

View File

@ -1,187 +0,0 @@
# Makefile for building Lua
# See ../doc/readme.html for installation and customization instructions.
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
PLAT= none
CC= gcc
CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
SYSCFLAGS=
SYSLDFLAGS=
SYSLIBS=
MYCFLAGS=
MYLDFLAGS=
MYLIBS=
MYOBJS=
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \
lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
LUA_T= lua
LUA_O= lua.o
LUAC_T= luac
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
# Targets start here.
default: $(PLAT)
all: $(ALL_T)
o: $(ALL_O)
a: $(ALL_A)
$(LUA_A): $(BASE_O)
$(AR) $@ $(BASE_O)
$(RANLIB) $@
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
$(RM) $(ALL_T) $(ALL_O)
depend:
@$(CC) $(CFLAGS) -MM l*.c
echo:
@echo "PLAT= $(PLAT)"
@echo "CC= $(CC)"
@echo "CFLAGS= $(CFLAGS)"
@echo "LDFLAGS= $(SYSLDFLAGS)"
@echo "LIBS= $(LIBS)"
@echo "AR= $(AR)"
@echo "RANLIB= $(RANLIB)"
@echo "RM= $(RM)"
# Convenience targets for popular platforms
ALL= all
none:
@echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
@echo " $(PLATS)"
aix:
$(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall"
ansi:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_ANSI"
bsd:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E"
freebsd:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline"
generic: $(ALL)
linux:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
macosx:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc
mingw:
$(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \
"AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
$(MAKE) "LUAC_T=luac.exe" luac.exe
posix:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX"
solaris:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl"
# list targets that do not create files (but not all makes understand .PHONY)
.PHONY: all $(PLATS) default o a clean depend echo none
# DO NOT DELETE
lapi.o: lapi.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \
lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h ltable.h lundump.h \
lvm.h
lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h
lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h
lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h
lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \
lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \
lstring.h ltable.h lvm.h
lcorolib.o: lcorolib.c lua.h luaconf.h lauxlib.h lualib.h
lctype.o: lctype.c lctype.h lua.h luaconf.h llimits.h
ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h
ldebug.o: ldebug.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \
ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h ldebug.h ldo.h \
lfunc.h lstring.h lgc.h ltable.h lvm.h
ldo.o: ldo.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \
lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h \
lstring.h ltable.h lundump.h lvm.h
ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \
lzio.h lmem.h lundump.h
lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h \
lstate.h ltm.h lzio.h lmem.h
lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h
liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h
llex.o: llex.c lua.h luaconf.h lctype.h llimits.h ldo.h lobject.h \
lstate.h ltm.h lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h
lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h
lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
ltm.h lzio.h lmem.h ldo.h lgc.h
loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h
lobject.o: lobject.c lua.h luaconf.h lctype.h llimits.h ldebug.h lstate.h \
lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h lvm.h
lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h
loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h
lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \
lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lfunc.h \
lstring.h lgc.h ltable.h
lstate.o: lstate.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \
ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h lstring.h \
ltable.h
lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \
ltm.h lzio.h lstring.h lgc.h
lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h
ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h
ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \
lmem.h lstring.h lgc.h ltable.h
lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h
luac.o: luac.c lua.h luaconf.h lauxlib.h lobject.h llimits.h lstate.h \
ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h
lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \
llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h
lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h
lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \
lzio.h

View File

@ -1,173 +0,0 @@
/*
** $Id: ldump.c,v 2.17.1.1 2013/04/12 18:48:47 roberto Exp $
** save precompiled Lua chunks
** See Copyright Notice in lua.h
*/
#include <stddef.h>
#define ldump_c
#define LUA_CORE
#include "lua.h"
#include "lobject.h"
#include "lstate.h"
#include "lundump.h"
typedef struct {
lua_State* L;
lua_Writer writer;
void* data;
int strip;
int status;
} DumpState;
#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D)
#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D)
static void DumpBlock(const void* b, size_t size, DumpState* D)
{
if (D->status==0)
{
lua_unlock(D->L);
D->status=(*D->writer)(D->L,b,size,D->data);
lua_lock(D->L);
}
}
static void DumpChar(int y, DumpState* D)
{
char x=(char)y;
DumpVar(x,D);
}
static void DumpInt(int x, DumpState* D)
{
DumpVar(x,D);
}
static void DumpNumber(lua_Number x, DumpState* D)
{
DumpVar(x,D);
}
static void DumpVector(const void* b, int n, size_t size, DumpState* D)
{
DumpInt(n,D);
DumpMem(b,n,size,D);
}
static void DumpString(const TString* s, DumpState* D)
{
if (s==NULL)
{
size_t size=0;
DumpVar(size,D);
}
else
{
size_t size=s->tsv.len+1; /* include trailing '\0' */
DumpVar(size,D);
DumpBlock(getstr(s),size*sizeof(char),D);
}
}
#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D)
static void DumpFunction(const Proto* f, DumpState* D);
static void DumpConstants(const Proto* f, DumpState* D)
{
int i,n=f->sizek;
DumpInt(n,D);
for (i=0; i<n; i++)
{
const TValue* o=&f->k[i];
DumpChar(ttypenv(o),D);
switch (ttypenv(o))
{
case LUA_TNIL:
break;
case LUA_TBOOLEAN:
DumpChar(bvalue(o),D);
break;
case LUA_TNUMBER:
DumpNumber(nvalue(o),D);
break;
case LUA_TSTRING:
DumpString(rawtsvalue(o),D);
break;
default: lua_assert(0);
}
}
n=f->sizep;
DumpInt(n,D);
for (i=0; i<n; i++) DumpFunction(f->p[i],D);
}
static void DumpUpvalues(const Proto* f, DumpState* D)
{
int i,n=f->sizeupvalues;
DumpInt(n,D);
for (i=0; i<n; i++)
{
DumpChar(f->upvalues[i].instack,D);
DumpChar(f->upvalues[i].idx,D);
}
}
static void DumpDebug(const Proto* f, DumpState* D)
{
int i,n;
DumpString((D->strip) ? NULL : f->source,D);
n= (D->strip) ? 0 : f->sizelineinfo;
DumpVector(f->lineinfo,n,sizeof(int),D);
n= (D->strip) ? 0 : f->sizelocvars;
DumpInt(n,D);
for (i=0; i<n; i++)
{
DumpString(f->locvars[i].varname,D);
DumpInt(f->locvars[i].startpc,D);
DumpInt(f->locvars[i].endpc,D);
}
n= (D->strip) ? 0 : f->sizeupvalues;
DumpInt(n,D);
for (i=0; i<n; i++) DumpString(f->upvalues[i].name,D);
}
static void DumpFunction(const Proto* f, DumpState* D)
{
DumpInt(f->linedefined,D);
DumpInt(f->lastlinedefined,D);
DumpChar(f->numparams,D);
DumpChar(f->is_vararg,D);
DumpChar(f->maxstacksize,D);
DumpCode(f,D);
DumpConstants(f,D);
DumpUpvalues(f,D);
DumpDebug(f,D);
}
static void DumpHeader(DumpState* D)
{
lu_byte h[LUAC_HEADERSIZE];
luaU_header(h);
DumpBlock(h,LUAC_HEADERSIZE,D);
}
/*
** dump Lua function as precompiled chunk
*/
int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)
{
DumpState D;
D.L=L;
D.writer=w;
D.data=data;
D.strip=strip;
D.status=0;
DumpHeader(&D);
DumpFunction(f,&D);
return D.status;
}

View File

@ -1,161 +0,0 @@
/*
** $Id: lfunc.c,v 2.30.1.1 2013/04/12 18:48:47 roberto Exp $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
#include <stddef.h>
#define lfunc_c
#define LUA_CORE
#include "lua.h"
#include "lfunc.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
Closure *luaF_newCclosure (lua_State *L, int n) {
Closure *c = &luaC_newobj(L, LUA_TCCL, sizeCclosure(n), NULL, 0)->cl;
c->c.nupvalues = cast_byte(n);
return c;
}
Closure *luaF_newLclosure (lua_State *L, int n) {
Closure *c = &luaC_newobj(L, LUA_TLCL, sizeLclosure(n), NULL, 0)->cl;
c->l.p = NULL;
c->l.nupvalues = cast_byte(n);
while (n--) c->l.upvals[n] = NULL;
return c;
}
UpVal *luaF_newupval (lua_State *L) {
UpVal *uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), NULL, 0)->uv;
uv->v = &uv->u.value;
setnilvalue(uv->v);
return uv;
}
UpVal *luaF_findupval (lua_State *L, StkId level) {
global_State *g = G(L);
GCObject **pp = &L->openupval;
UpVal *p;
UpVal *uv;
while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {
GCObject *o = obj2gco(p);
lua_assert(p->v != &p->u.value);
lua_assert(!isold(o) || isold(obj2gco(L)));
if (p->v == level) { /* found a corresponding upvalue? */
if (isdead(g, o)) /* is it dead? */
changewhite(o); /* resurrect it */
return p;
}
pp = &p->next;
}
/* not found: create a new one */
uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), pp, 0)->uv;
uv->v = level; /* current value lives in the stack */
uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */
uv->u.l.next = g->uvhead.u.l.next;
uv->u.l.next->u.l.prev = uv;
g->uvhead.u.l.next = uv;
lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
return uv;
}
static void unlinkupval (UpVal *uv) {
lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */
uv->u.l.prev->u.l.next = uv->u.l.next;
}
void luaF_freeupval (lua_State *L, UpVal *uv) {
if (uv->v != &uv->u.value) /* is it open? */
unlinkupval(uv); /* remove from open list */
luaM_free(L, uv); /* free upvalue */
}
void luaF_close (lua_State *L, StkId level) {
UpVal *uv;
global_State *g = G(L);
while (L->openupval != NULL && (uv = gco2uv(L->openupval))->v >= level) {
GCObject *o = obj2gco(uv);
lua_assert(!isblack(o) && uv->v != &uv->u.value);
L->openupval = uv->next; /* remove from `open' list */
if (isdead(g, o))
luaF_freeupval(L, uv); /* free upvalue */
else {
unlinkupval(uv); /* remove upvalue from 'uvhead' list */
setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */
uv->v = &uv->u.value; /* now current value lives here */
gch(o)->next = g->allgc; /* link upvalue into 'allgc' list */
g->allgc = o;
luaC_checkupvalcolor(g, uv);
}
}
}
Proto *luaF_newproto (lua_State *L) {
Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), NULL, 0)->p;
f->k = NULL;
f->sizek = 0;
f->p = NULL;
f->sizep = 0;
f->code = NULL;
f->cache = NULL;
f->sizecode = 0;
f->lineinfo = NULL;
f->sizelineinfo = 0;
f->upvalues = NULL;
f->sizeupvalues = 0;
f->numparams = 0;
f->is_vararg = 0;
f->maxstacksize = 0;
f->locvars = NULL;
f->sizelocvars = 0;
f->linedefined = 0;
f->lastlinedefined = 0;
f->source = NULL;
return f;
}
void luaF_freeproto (lua_State *L, Proto *f) {
luaM_freearray(L, f->code, f->sizecode);
luaM_freearray(L, f->p, f->sizep);
luaM_freearray(L, f->k, f->sizek);
luaM_freearray(L, f->lineinfo, f->sizelineinfo);
luaM_freearray(L, f->locvars, f->sizelocvars);
luaM_freearray(L, f->upvalues, f->sizeupvalues);
luaM_free(L, f);
}
/*
** Look for n-th local variable at line `line' in function `func'.
** Returns NULL if not found.
*/
const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
int i;
for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {
if (pc < f->locvars[i].endpc) { /* is variable active? */
local_number--;
if (local_number == 0)
return getstr(f->locvars[i].varname);
}
}
return NULL; /* not found */
}

View File

@ -1,309 +0,0 @@
/*
** $Id: llimits.h,v 1.103.1.1 2013/04/12 18:48:47 roberto Exp $
** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h
*/
#ifndef llimits_h
#define llimits_h
#include <limits.h>
#include <stddef.h>
#include "lua.h"
typedef unsigned LUA_INT32 lu_int32;
typedef LUAI_UMEM lu_mem;
typedef LUAI_MEM l_mem;
/* chars used as small naturals (so that `char' is reserved for characters) */
typedef unsigned char lu_byte;
#define MAX_SIZET ((size_t)(~(size_t)0)-2)
#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
#define MAX_LMEM ((l_mem) ((MAX_LUMEM >> 1) - 2))
#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
/*
** conversion of pointer to integer
** this is for hashing only; there is no problem if the integer
** cannot hold the whole pointer value
*/
#define IntPoint(p) ((unsigned int)(lu_mem)(p))
/* type to ensure maximum alignment */
#if !defined(LUAI_USER_ALIGNMENT_T)
#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
#endif
typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
/* result of a `usual argument conversion' over lua_Number */
typedef LUAI_UACNUMBER l_uacNumber;
/* internal assertions for in-house debugging */
#if defined(lua_assert)
#define check_exp(c,e) (lua_assert(c), (e))
/* to avoid problems with conditions too long */
#define lua_longassert(c) { if (!(c)) lua_assert(0); }
#else
#define lua_assert(c) ((void)0)
#define check_exp(c,e) (e)
#define lua_longassert(c) ((void)0)
#endif
/*
** assertion for checking API calls
*/
#if !defined(luai_apicheck)
#if defined(LUA_USE_APICHECK)
#include <assert.h>
#define luai_apicheck(L,e) assert(e)
#else
#define luai_apicheck(L,e) lua_assert(e)
#endif
#endif
#define api_check(l,e,msg) luai_apicheck(l,(e) && msg)
#if !defined(UNUSED)
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
#endif
#define cast(t, exp) ((t)(exp))
#define cast_byte(i) cast(lu_byte, (i))
#define cast_num(i) cast(lua_Number, (i))
#define cast_int(i) cast(int, (i))
#define cast_uchar(i) cast(unsigned char, (i))
/*
** non-return type
*/
#if defined(__GNUC__)
#define l_noret void __attribute__((noreturn))
#elif defined(_MSC_VER)
#define l_noret void __declspec(noreturn)
#else
#define l_noret void
#endif
/*
** maximum depth for nested C calls and syntactical nested non-terminals
** in a program. (Value must fit in an unsigned short int.)
*/
#if !defined(LUAI_MAXCCALLS)
#define LUAI_MAXCCALLS 200
#endif
/*
** maximum number of upvalues in a closure (both C and Lua). (Value
** must fit in an unsigned char.)
*/
#define MAXUPVAL UCHAR_MAX
/*
** type for virtual-machine instructions
** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
*/
typedef lu_int32 Instruction;
/* maximum stack for a Lua function */
#define MAXSTACK 250
/* minimum size for the string table (must be power of 2) */
#if !defined(MINSTRTABSIZE)
#define MINSTRTABSIZE 32
#endif
/* minimum size for string buffer */
#if !defined(LUA_MINBUFFER)
#define LUA_MINBUFFER 32
#endif
#if !defined(lua_lock)
#define lua_lock(L) ((void) 0)
#define lua_unlock(L) ((void) 0)
#endif
#if !defined(luai_threadyield)
#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
#endif
/*
** these macros allow user-specific actions on threads when you defined
** LUAI_EXTRASPACE and need to do something extra when a thread is
** created/deleted/resumed/yielded.
*/
#if !defined(luai_userstateopen)
#define luai_userstateopen(L) ((void)L)
#endif
#if !defined(luai_userstateclose)
#define luai_userstateclose(L) ((void)L)
#endif
#if !defined(luai_userstatethread)
#define luai_userstatethread(L,L1) ((void)L)
#endif
#if !defined(luai_userstatefree)
#define luai_userstatefree(L,L1) ((void)L)
#endif
#if !defined(luai_userstateresume)
#define luai_userstateresume(L,n) ((void)L)
#endif
#if !defined(luai_userstateyield)
#define luai_userstateyield(L,n) ((void)L)
#endif
/*
** lua_number2int is a macro to convert lua_Number to int.
** lua_number2integer is a macro to convert lua_Number to lua_Integer.
** lua_number2unsigned is a macro to convert a lua_Number to a lua_Unsigned.
** lua_unsigned2number is a macro to convert a lua_Unsigned to a lua_Number.
** luai_hashnum is a macro to hash a lua_Number value into an integer.
** The hash must be deterministic and give reasonable values for
** both small and large values (outside the range of integers).
*/
#if defined(MS_ASMTRICK) || defined(LUA_MSASMTRICK) /* { */
/* trick with Microsoft assembler for X86 */
#define lua_number2int(i,n) __asm {__asm fld n __asm fistp i}
#define lua_number2integer(i,n) lua_number2int(i, n)
#define lua_number2unsigned(i,n) \
{__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;}
#elif defined(LUA_IEEE754TRICK) /* }{ */
/* the next trick should work on any machine using IEEE754 with
a 32-bit int type */
union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
#if !defined(LUA_IEEEENDIAN) /* { */
#define LUAI_EXTRAIEEE \
static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)};
#define LUA_IEEEENDIANLOC (ieeeendian.l_p[1] == 33)
#else
#define LUA_IEEEENDIANLOC LUA_IEEEENDIAN
#define LUAI_EXTRAIEEE /* empty */
#endif /* } */
#define lua_number2int32(i,n,t) \
{ LUAI_EXTRAIEEE \
volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \
(i) = (t)u.l_p[LUA_IEEEENDIANLOC]; }
#define luai_hashnum(i,n) \
{ volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \
(i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */
#define lua_number2int(i,n) lua_number2int32(i, n, int)
#define lua_number2unsigned(i,n) lua_number2int32(i, n, lua_Unsigned)
/* the trick can be expanded to lua_Integer when it is a 32-bit value */
#if defined(LUA_IEEELL)
#define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer)
#endif
#endif /* } */
/* the following definitions always work, but may be slow */
#if !defined(lua_number2int)
#define lua_number2int(i,n) ((i)=(int)(n))
#endif
#if !defined(lua_number2integer)
#define lua_number2integer(i,n) ((i)=(lua_Integer)(n))
#endif
#if !defined(lua_number2unsigned) /* { */
/* the following definition assures proper modulo behavior */
#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_NUMBER_FLOAT)
#include <math.h>
#define SUPUNSIGNED ((lua_Number)(~(lua_Unsigned)0) + 1)
#define lua_number2unsigned(i,n) \
((i)=(lua_Unsigned)((n) - floor((n)/SUPUNSIGNED)*SUPUNSIGNED))
#else
#define lua_number2unsigned(i,n) ((i)=(lua_Unsigned)(n))
#endif
#endif /* } */
#if !defined(lua_unsigned2number)
/* on several machines, coercion from unsigned to double is slow,
so it may be worth to avoid */
#define lua_unsigned2number(u) \
(((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u))
#endif
#if defined(ltable_c) && !defined(luai_hashnum)
#include <float.h>
#include <math.h>
#define luai_hashnum(i,n) { int e; \
n = l_mathop(frexp)(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP); \
lua_number2int(i, n); i += e; }
#endif
/*
** macro to control inclusion of some hard tests on stack reallocation
*/
#if !defined(HARDSTACKTESTS)
#define condmovestack(L) ((void)0)
#else
/* realloc stack keeping its size */
#define condmovestack(L) luaD_reallocstack((L), (L)->stacksize)
#endif
#if !defined(HARDMEMTESTS)
#define condchangemem(L) condmovestack(L)
#else
#define condchangemem(L) \
((void)(!(G(L)->gcrunning) || (luaC_fullgc(L, 0), 1)))
#endif
#endif

View File

@ -1,279 +0,0 @@
/*
** $Id: lmathlib.c,v 1.83.1.1 2013/04/12 18:48:47 roberto Exp $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
#include <stdlib.h>
#include <math.h>
#define lmathlib_c
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#undef PI
#define PI ((lua_Number)(3.1415926535897932384626433832795))
#define RADIANS_PER_DEGREE ((lua_Number)(PI/180.0))
static int math_abs (lua_State *L) {
lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1)));
return 1;
}
static int math_sin (lua_State *L) {
lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1)));
return 1;
}
static int math_sinh (lua_State *L) {
lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1)));
return 1;
}
static int math_cos (lua_State *L) {
lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1)));
return 1;
}
static int math_cosh (lua_State *L) {
lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1)));
return 1;
}
static int math_tan (lua_State *L) {
lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1)));
return 1;
}
static int math_tanh (lua_State *L) {
lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1)));
return 1;
}
static int math_asin (lua_State *L) {
lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1)));
return 1;
}
static int math_acos (lua_State *L) {
lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1)));
return 1;
}
static int math_atan (lua_State *L) {
lua_pushnumber(L, l_mathop(atan)(luaL_checknumber(L, 1)));
return 1;
}
static int math_atan2 (lua_State *L) {
lua_pushnumber(L, l_mathop(atan2)(luaL_checknumber(L, 1),
luaL_checknumber(L, 2)));
return 1;
}
static int math_ceil (lua_State *L) {
lua_pushnumber(L, l_mathop(ceil)(luaL_checknumber(L, 1)));
return 1;
}
static int math_floor (lua_State *L) {
lua_pushnumber(L, l_mathop(floor)(luaL_checknumber(L, 1)));
return 1;
}
static int math_fmod (lua_State *L) {
lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1),
luaL_checknumber(L, 2)));
return 1;
}
static int math_modf (lua_State *L) {
lua_Number ip;
lua_Number fp = l_mathop(modf)(luaL_checknumber(L, 1), &ip);
lua_pushnumber(L, ip);
lua_pushnumber(L, fp);
return 2;
}
static int math_sqrt (lua_State *L) {
lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1)));
return 1;
}
static int math_pow (lua_State *L) {
lua_Number x = luaL_checknumber(L, 1);
lua_Number y = luaL_checknumber(L, 2);
lua_pushnumber(L, l_mathop(pow)(x, y));
return 1;
}
static int math_log (lua_State *L) {
lua_Number x = luaL_checknumber(L, 1);
lua_Number res;
if (lua_isnoneornil(L, 2))
res = l_mathop(log)(x);
else {
lua_Number base = luaL_checknumber(L, 2);
if (base == (lua_Number)10.0) res = l_mathop(log10)(x);
else res = l_mathop(log)(x)/l_mathop(log)(base);
}
lua_pushnumber(L, res);
return 1;
}
#if defined(LUA_COMPAT_LOG10)
static int math_log10 (lua_State *L) {
lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1)));
return 1;
}
#endif
static int math_exp (lua_State *L) {
lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1)));
return 1;
}
static int math_deg (lua_State *L) {
lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE);
return 1;
}
static int math_rad (lua_State *L) {
lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE);
return 1;
}
static int math_frexp (lua_State *L) {
int e;
lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e));
lua_pushinteger(L, e);
return 2;
}
static int math_ldexp (lua_State *L) {
lua_Number x = luaL_checknumber(L, 1);
int ep = luaL_checkint(L, 2);
lua_pushnumber(L, l_mathop(ldexp)(x, ep));
return 1;
}
static int math_min (lua_State *L) {
int n = lua_gettop(L); /* number of arguments */
lua_Number dmin = luaL_checknumber(L, 1);
int i;
for (i=2; i<=n; i++) {
lua_Number d = luaL_checknumber(L, i);
if (d < dmin)
dmin = d;
}
lua_pushnumber(L, dmin);
return 1;
}
static int math_max (lua_State *L) {
int n = lua_gettop(L); /* number of arguments */
lua_Number dmax = luaL_checknumber(L, 1);
int i;
for (i=2; i<=n; i++) {
lua_Number d = luaL_checknumber(L, i);
if (d > dmax)
dmax = d;
}
lua_pushnumber(L, dmax);
return 1;
}
static int math_random (lua_State *L) {
/* the `%' avoids the (rare) case of r==1, and is needed also because on
some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
switch (lua_gettop(L)) { /* check number of arguments */
case 0: { /* no arguments */
lua_pushnumber(L, r); /* Number between 0 and 1 */
break;
}
case 1: { /* only upper limit */
lua_Number u = luaL_checknumber(L, 1);
luaL_argcheck(L, (lua_Number)1.0 <= u, 1, "interval is empty");
lua_pushnumber(L, l_mathop(floor)(r*u) + (lua_Number)(1.0)); /* [1, u] */
break;
}
case 2: { /* lower and upper limits */
lua_Number l = luaL_checknumber(L, 1);
lua_Number u = luaL_checknumber(L, 2);
luaL_argcheck(L, l <= u, 2, "interval is empty");
lua_pushnumber(L, l_mathop(floor)(r*(u-l+1)) + l); /* [l, u] */
break;
}
default: return luaL_error(L, "wrong number of arguments");
}
return 1;
}
static int math_randomseed (lua_State *L) {
srand(luaL_checkunsigned(L, 1));
(void)rand(); /* discard first value to avoid undesirable correlations */
return 0;
}
static const luaL_Reg mathlib[] = {
{"abs", math_abs},
{"acos", math_acos},
{"asin", math_asin},
{"atan2", math_atan2},
{"atan", math_atan},
{"ceil", math_ceil},
{"cosh", math_cosh},
{"cos", math_cos},
{"deg", math_deg},
{"exp", math_exp},
{"floor", math_floor},
{"fmod", math_fmod},
{"frexp", math_frexp},
{"ldexp", math_ldexp},
#if defined(LUA_COMPAT_LOG10)
{"log10", math_log10},
#endif
{"log", math_log},
{"max", math_max},
{"min", math_min},
{"modf", math_modf},
{"pow", math_pow},
{"rad", math_rad},
{"random", math_random},
{"randomseed", math_randomseed},
{"sinh", math_sinh},
{"sin", math_sin},
{"sqrt", math_sqrt},
{"tanh", math_tanh},
{"tan", math_tan},
{NULL, NULL}
};
/*
** Open math library
*/
LUAMOD_API int luaopen_math (lua_State *L) {
luaL_newlib(L, mathlib);
lua_pushnumber(L, PI);
lua_setfield(L, -2, "pi");
lua_pushnumber(L, HUGE_VAL);
lua_setfield(L, -2, "huge");
return 1;
}

View File

@ -1,287 +0,0 @@
/*
** $Id: lobject.c,v 2.58.1.1 2013/04/12 18:48:47 roberto Exp $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define lobject_c
#define LUA_CORE
#include "lua.h"
#include "lctype.h"
#include "ldebug.h"
#include "ldo.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
#include "lvm.h"
LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT};
/*
** converts an integer to a "floating point byte", represented as
** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if
** eeeee != 0 and (xxx) otherwise.
*/
int luaO_int2fb (unsigned int x) {
int e = 0; /* exponent */
if (x < 8) return x;
while (x >= 0x10) {
x = (x+1) >> 1;
e++;
}
return ((e+1) << 3) | (cast_int(x) - 8);
}
/* converts back */
int luaO_fb2int (int x) {
int e = (x >> 3) & 0x1f;
if (e == 0) return x;
else return ((x & 7) + 8) << (e - 1);
}
int luaO_ceillog2 (unsigned int x) {
static const lu_byte log_2[256] = {
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
};
int l = 0;
x--;
while (x >= 256) { l += 8; x >>= 8; }
return l + log_2[x];
}
lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2) {
switch (op) {
case LUA_OPADD: return luai_numadd(NULL, v1, v2);
case LUA_OPSUB: return luai_numsub(NULL, v1, v2);
case LUA_OPMUL: return luai_nummul(NULL, v1, v2);
case LUA_OPDIV: return luai_numdiv(NULL, v1, v2);
case LUA_OPMOD: return luai_nummod(NULL, v1, v2);
case LUA_OPPOW: return luai_numpow(NULL, v1, v2);
case LUA_OPUNM: return luai_numunm(NULL, v1);
default: lua_assert(0); return 0;
}
}
int luaO_hexavalue (int c) {
if (lisdigit(c)) return c - '0';
else return ltolower(c) - 'a' + 10;
}
#if !defined(lua_strx2number)
#include <math.h>
static int isneg (const char **s) {
if (**s == '-') { (*s)++; return 1; }
else if (**s == '+') (*s)++;
return 0;
}
static lua_Number readhexa (const char **s, lua_Number r, int *count) {
for (; lisxdigit(cast_uchar(**s)); (*s)++) { /* read integer part */
r = (r * cast_num(16.0)) + cast_num(luaO_hexavalue(cast_uchar(**s)));
(*count)++;
}
return r;
}
/*
** convert an hexadecimal numeric string to a number, following
** C99 specification for 'strtod'
*/
static lua_Number lua_strx2number (const char *s, char **endptr) {
lua_Number r = 0.0;
int e = 0, i = 0;
int neg = 0; /* 1 if number is negative */
*endptr = cast(char *, s); /* nothing is valid yet */
while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */
neg = isneg(&s); /* check signal */
if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */
return 0.0; /* invalid format (no '0x') */
s += 2; /* skip '0x' */
r = readhexa(&s, r, &i); /* read integer part */
if (*s == '.') {
s++; /* skip dot */
r = readhexa(&s, r, &e); /* read fractional part */
}
if (i == 0 && e == 0)
return 0.0; /* invalid format (no digit) */
e *= -4; /* each fractional digit divides value by 2^-4 */
*endptr = cast(char *, s); /* valid up to here */
if (*s == 'p' || *s == 'P') { /* exponent part? */
int exp1 = 0;
int neg1;
s++; /* skip 'p' */
neg1 = isneg(&s); /* signal */
if (!lisdigit(cast_uchar(*s)))
goto ret; /* must have at least one digit */
while (lisdigit(cast_uchar(*s))) /* read exponent */
exp1 = exp1 * 10 + *(s++) - '0';
if (neg1) exp1 = -exp1;
e += exp1;
}
*endptr = cast(char *, s); /* valid up to here */
ret:
if (neg) r = -r;
return l_mathop(ldexp)(r, e);
}
#endif
int luaO_str2d (const char *s, size_t len, lua_Number *result) {
char *endptr;
if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */
return 0;
else if (strpbrk(s, "xX")) /* hexa? */
*result = lua_strx2number(s, &endptr);
else
*result = lua_str2number(s, &endptr);
if (endptr == s) return 0; /* nothing recognized */
while (lisspace(cast_uchar(*endptr))) endptr++;
return (endptr == s + len); /* OK if no trailing characters */
}
static void pushstr (lua_State *L, const char *str, size_t l) {
setsvalue2s(L, L->top++, luaS_newlstr(L, str, l));
}
/* this function handles only `%d', `%c', %f, %p, and `%s' formats */
const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
int n = 0;
for (;;) {
const char *e = strchr(fmt, '%');
if (e == NULL) break;
luaD_checkstack(L, 2); /* fmt + item */
pushstr(L, fmt, e - fmt);
switch (*(e+1)) {
case 's': {
const char *s = va_arg(argp, char *);
if (s == NULL) s = "(null)";
pushstr(L, s, strlen(s));
break;
}
case 'c': {
char buff;
buff = cast(char, va_arg(argp, int));
pushstr(L, &buff, 1);
break;
}
case 'd': {
setnvalue(L->top++, cast_num(va_arg(argp, int)));
break;
}
case 'f': {
setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber)));
break;
}
case 'p': {
char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
int l = sprintf(buff, "%p", va_arg(argp, void *));
pushstr(L, buff, l);
break;
}
case '%': {
pushstr(L, "%", 1);
break;
}
default: {
luaG_runerror(L,
"invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"),
*(e + 1));
}
}
n += 2;
fmt = e+2;
}
luaD_checkstack(L, 1);
pushstr(L, fmt, strlen(fmt));
if (n > 0) luaV_concat(L, n + 1);
return svalue(L->top - 1);
}
const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
const char *msg;
va_list argp;
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp);
va_end(argp);
return msg;
}
/* number of chars of a literal string without the ending \0 */
#define LL(x) (sizeof(x)/sizeof(char) - 1)
#define RETS "..."
#define PRE "[string \""
#define POS "\"]"
#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) )
void luaO_chunkid (char *out, const char *source, size_t bufflen) {
size_t l = strlen(source);
if (*source == '=') { /* 'literal' source */
if (l <= bufflen) /* small enough? */
memcpy(out, source + 1, l * sizeof(char));
else { /* truncate it */
addstr(out, source + 1, bufflen - 1);
*out = '\0';
}
}
else if (*source == '@') { /* file name */
if (l <= bufflen) /* small enough? */
memcpy(out, source + 1, l * sizeof(char));
else { /* add '...' before rest of name */
addstr(out, RETS, LL(RETS));
bufflen -= LL(RETS);
memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char));
}
}
else { /* string; format as [string "source"] */
const char *nl = strchr(source, '\n'); /* find first new line (if any) */
addstr(out, PRE, LL(PRE)); /* add prefix */
bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */
if (l < bufflen && nl == NULL) { /* small one-line source? */
addstr(out, source, l); /* keep it */
}
else {
if (nl != NULL) l = nl - source; /* stop at first newline */
if (l > bufflen) l = bufflen;
addstr(out, source, l);
addstr(out, RETS, LL(RETS));
}
memcpy(out, POS, (LL(POS) + 1) * sizeof(char));
}
}

View File

@ -1,185 +0,0 @@
/*
** $Id: lstring.c,v 2.26.1.1 2013/04/12 18:48:47 roberto Exp $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
#include <string.h>
#define lstring_c
#define LUA_CORE
#include "lua.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
/*
** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to
** compute its hash
*/
#if !defined(LUAI_HASHLIMIT)
#define LUAI_HASHLIMIT 5
#endif
/*
** equality for long strings
*/
int luaS_eqlngstr (TString *a, TString *b) {
size_t len = a->tsv.len;
lua_assert(a->tsv.tt == LUA_TLNGSTR && b->tsv.tt == LUA_TLNGSTR);
return (a == b) || /* same instance or... */
((len == b->tsv.len) && /* equal length and ... */
(memcmp(getstr(a), getstr(b), len) == 0)); /* equal contents */
}
/*
** equality for strings
*/
int luaS_eqstr (TString *a, TString *b) {
return (a->tsv.tt == b->tsv.tt) &&
(a->tsv.tt == LUA_TSHRSTR ? eqshrstr(a, b) : luaS_eqlngstr(a, b));
}
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
unsigned int h = seed ^ cast(unsigned int, l);
size_t l1;
size_t step = (l >> LUAI_HASHLIMIT) + 1;
for (l1 = l; l1 >= step; l1 -= step)
h = h ^ ((h<<5) + (h>>2) + cast_byte(str[l1 - 1]));
return h;
}
/*
** resizes the string table
*/
void luaS_resize (lua_State *L, int newsize) {
int i;
stringtable *tb = &G(L)->strt;
/* cannot resize while GC is traversing strings */
luaC_runtilstate(L, ~bitmask(GCSsweepstring));
if (newsize > tb->size) {
luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);
for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL;
}
/* rehash */
for (i=0; i<tb->size; i++) {
GCObject *p = tb->hash[i];
tb->hash[i] = NULL;
while (p) { /* for each node in the list */
GCObject *next = gch(p)->next; /* save next */
unsigned int h = lmod(gco2ts(p)->hash, newsize); /* new position */
gch(p)->next = tb->hash[h]; /* chain it */
tb->hash[h] = p;
resetoldbit(p); /* see MOVE OLD rule */
p = next;
}
}
if (newsize < tb->size) {
/* shrinking slice must be empty */
lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL);
luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);
}
tb->size = newsize;
}
/*
** creates a new string object
*/
static TString *createstrobj (lua_State *L, const char *str, size_t l,
int tag, unsigned int h, GCObject **list) {
TString *ts;
size_t totalsize; /* total size of TString object */
totalsize = sizeof(TString) + ((l + 1) * sizeof(char));
ts = &luaC_newobj(L, tag, totalsize, list, 0)->ts;
ts->tsv.len = l;
ts->tsv.hash = h;
ts->tsv.extra = 0;
memcpy(ts+1, str, l*sizeof(char));
((char *)(ts+1))[l] = '\0'; /* ending 0 */
return ts;
}
/*
** creates a new short string, inserting it into string table
*/
static TString *newshrstr (lua_State *L, const char *str, size_t l,
unsigned int h) {
GCObject **list; /* (pointer to) list where it will be inserted */
stringtable *tb = &G(L)->strt;
TString *s;
if (tb->nuse >= cast(lu_int32, tb->size) && tb->size <= MAX_INT/2)
luaS_resize(L, tb->size*2); /* too crowded */
list = &tb->hash[lmod(h, tb->size)];
s = createstrobj(L, str, l, LUA_TSHRSTR, h, list);
tb->nuse++;
return s;
}
/*
** checks whether short string exists and reuses it or creates a new one
*/
static TString *internshrstr (lua_State *L, const char *str, size_t l) {
GCObject *o;
global_State *g = G(L);
unsigned int h = luaS_hash(str, l, g->seed);
for (o = g->strt.hash[lmod(h, g->strt.size)];
o != NULL;
o = gch(o)->next) {
TString *ts = rawgco2ts(o);
if (h == ts->tsv.hash &&
l == ts->tsv.len &&
(memcmp(str, getstr(ts), l * sizeof(char)) == 0)) {
if (isdead(G(L), o)) /* string is dead (but was not collected yet)? */
changewhite(o); /* resurrect it */
return ts;
}
}
return newshrstr(L, str, l, h); /* not found; create a new string */
}
/*
** new string (with explicit length)
*/
TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
if (l <= LUAI_MAXSHORTLEN) /* short string? */
return internshrstr(L, str, l);
else {
if (l + 1 > (MAX_SIZET - sizeof(TString))/sizeof(char))
luaM_toobig(L);
return createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed, NULL);
}
}
/*
** new zero-terminated string
*/
TString *luaS_new (lua_State *L, const char *str) {
return luaS_newlstr(L, str, strlen(str));
}
Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
Udata *u;
if (s > MAX_SIZET - sizeof(Udata))
luaM_toobig(L);
u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;
u->uv.len = s;
u->uv.metatable = NULL;
u->uv.env = e;
return u;
}

View File

@ -1,283 +0,0 @@
/*
** $Id: ltablib.c,v 1.65.1.1 2013/04/12 18:48:47 roberto Exp $
** Library for Table Manipulation
** See Copyright Notice in lua.h
*/
#include <stddef.h>
#define ltablib_c
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n))
#if defined(LUA_COMPAT_MAXN)
static int maxn (lua_State *L) {
lua_Number max = 0;
luaL_checktype(L, 1, LUA_TTABLE);
lua_pushnil(L); /* first key */
while (lua_next(L, 1)) {
lua_pop(L, 1); /* remove value */
if (lua_type(L, -1) == LUA_TNUMBER) {
lua_Number v = lua_tonumber(L, -1);
if (v > max) max = v;
}
}
lua_pushnumber(L, max);
return 1;
}
#endif
static int tinsert (lua_State *L) {
int e = aux_getn(L, 1) + 1; /* first empty element */
int pos; /* where to insert new element */
switch (lua_gettop(L)) {
case 2: { /* called with only 2 arguments */
pos = e; /* insert new element at the end */
break;
}
case 3: {
int i;
pos = luaL_checkint(L, 2); /* 2nd argument is the position */
luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds");
for (i = e; i > pos; i--) { /* move up elements */
lua_rawgeti(L, 1, i-1);
lua_rawseti(L, 1, i); /* t[i] = t[i-1] */
}
break;
}
default: {
return luaL_error(L, "wrong number of arguments to " LUA_QL("insert"));
}
}
lua_rawseti(L, 1, pos); /* t[pos] = v */
return 0;
}
static int tremove (lua_State *L) {
int size = aux_getn(L, 1);
int pos = luaL_optint(L, 2, size);
if (pos != size) /* validate 'pos' if given */
luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
lua_rawgeti(L, 1, pos); /* result = t[pos] */
for ( ; pos < size; pos++) {
lua_rawgeti(L, 1, pos+1);
lua_rawseti(L, 1, pos); /* t[pos] = t[pos+1] */
}
lua_pushnil(L);
lua_rawseti(L, 1, pos); /* t[pos] = nil */
return 1;
}
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
lua_rawgeti(L, 1, i);
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
LUA_QL("concat"), luaL_typename(L, -1), i);
luaL_addvalue(b);
}
static int tconcat (lua_State *L) {
luaL_Buffer b;
size_t lsep;
int i, last;
const char *sep = luaL_optlstring(L, 2, "", &lsep);
luaL_checktype(L, 1, LUA_TTABLE);
i = luaL_optint(L, 3, 1);
last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1));
luaL_buffinit(L, &b);
for (; i < last; i++) {
addfield(L, &b, i);
luaL_addlstring(&b, sep, lsep);
}
if (i == last) /* add last value (if interval was not empty) */
addfield(L, &b, i);
luaL_pushresult(&b);
return 1;
}
/*
** {======================================================
** Pack/unpack
** =======================================================
*/
static int pack (lua_State *L) {
int n = lua_gettop(L); /* number of elements to pack */
lua_createtable(L, n, 1); /* create result table */
lua_pushinteger(L, n);
lua_setfield(L, -2, "n"); /* t.n = number of elements */
if (n > 0) { /* at least one element? */
int i;
lua_pushvalue(L, 1);
lua_rawseti(L, -2, 1); /* insert first element */
lua_replace(L, 1); /* move table into index 1 */
for (i = n; i >= 2; i--) /* assign other elements */
lua_rawseti(L, 1, i);
}
return 1; /* return table */
}
static int unpack (lua_State *L) {
int i, e, n;
luaL_checktype(L, 1, LUA_TTABLE);
i = luaL_optint(L, 2, 1);
e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));
if (i > e) return 0; /* empty range */
n = e - i + 1; /* number of elements */
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
return luaL_error(L, "too many results to unpack");
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
while (i++ < e) /* push arg[i + 1...e] */
lua_rawgeti(L, 1, i);
return n;
}
/* }====================================================== */
/*
** {======================================================
** Quicksort
** (based on `Algorithms in MODULA-3', Robert Sedgewick;
** Addison-Wesley, 1993.)
** =======================================================
*/
static void set2 (lua_State *L, int i, int j) {
lua_rawseti(L, 1, i);
lua_rawseti(L, 1, j);
}
static int sort_comp (lua_State *L, int a, int b) {
if (!lua_isnil(L, 2)) { /* function? */
int res;
lua_pushvalue(L, 2);
lua_pushvalue(L, a-1); /* -1 to compensate function */
lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */
lua_call(L, 2, 1);
res = lua_toboolean(L, -1);
lua_pop(L, 1);
return res;
}
else /* a < b? */
return lua_compare(L, a, b, LUA_OPLT);
}
static void auxsort (lua_State *L, int l, int u) {
while (l < u) { /* for tail recursion */
int i, j;
/* sort elements a[l], a[(l+u)/2] and a[u] */
lua_rawgeti(L, 1, l);
lua_rawgeti(L, 1, u);
if (sort_comp(L, -1, -2)) /* a[u] < a[l]? */
set2(L, l, u); /* swap a[l] - a[u] */
else
lua_pop(L, 2);
if (u-l == 1) break; /* only 2 elements */
i = (l+u)/2;
lua_rawgeti(L, 1, i);
lua_rawgeti(L, 1, l);
if (sort_comp(L, -2, -1)) /* a[i]<a[l]? */
set2(L, i, l);
else {
lua_pop(L, 1); /* remove a[l] */
lua_rawgeti(L, 1, u);
if (sort_comp(L, -1, -2)) /* a[u]<a[i]? */
set2(L, i, u);
else
lua_pop(L, 2);
}
if (u-l == 2) break; /* only 3 elements */
lua_rawgeti(L, 1, i); /* Pivot */
lua_pushvalue(L, -1);
lua_rawgeti(L, 1, u-1);
set2(L, i, u-1);
/* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */
i = l; j = u-1;
for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */
/* repeat ++i until a[i] >= P */
while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
if (i>=u) luaL_error(L, "invalid order function for sorting");
lua_pop(L, 1); /* remove a[i] */
}
/* repeat --j until a[j] <= P */
while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
if (j<=l) luaL_error(L, "invalid order function for sorting");
lua_pop(L, 1); /* remove a[j] */
}
if (j<i) {
lua_pop(L, 3); /* pop pivot, a[i], a[j] */
break;
}
set2(L, i, j);
}
lua_rawgeti(L, 1, u-1);
lua_rawgeti(L, 1, i);
set2(L, u-1, i); /* swap pivot (a[u-1]) with a[i] */
/* a[l..i-1] <= a[i] == P <= a[i+1..u] */
/* adjust so that smaller half is in [j..i] and larger one in [l..u] */
if (i-l < u-i) {
j=l; i=i-1; l=i+2;
}
else {
j=i+1; i=u; u=j-2;
}
auxsort(L, j, i); /* call recursively the smaller one */
} /* repeat the routine for the larger one */
}
static int sort (lua_State *L) {
int n = aux_getn(L, 1);
luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */
if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
luaL_checktype(L, 2, LUA_TFUNCTION);
lua_settop(L, 2); /* make sure there is two arguments */
auxsort(L, 1, n);
return 0;
}
/* }====================================================== */
static const luaL_Reg tab_funcs[] = {
{"concat", tconcat},
#if defined(LUA_COMPAT_MAXN)
{"maxn", maxn},
#endif
{"insert", tinsert},
{"pack", pack},
{"unpack", unpack},
{"remove", tremove},
{"sort", sort},
{NULL, NULL}
};
LUAMOD_API int luaopen_table (lua_State *L) {
luaL_newlib(L, tab_funcs);
#if defined(LUA_COMPAT_UNPACK)
/* _G.unpack = table.unpack */
lua_getfield(L, -1, "unpack");
lua_setglobal(L, "unpack");
#endif
return 1;
}

View File

@ -1,77 +0,0 @@
/*
** $Id: ltm.c,v 2.14.1.1 2013/04/12 18:48:47 roberto Exp $
** Tag methods
** See Copyright Notice in lua.h
*/
#include <string.h>
#define ltm_c
#define LUA_CORE
#include "lua.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
static const char udatatypename[] = "userdata";
LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {
"no value",
"nil", "boolean", udatatypename, "number",
"string", "table", "function", udatatypename, "thread",
"proto", "upval" /* these last two cases are used for tests only */
};
void luaT_init (lua_State *L) {
static const char *const luaT_eventname[] = { /* ORDER TM */
"__index", "__newindex",
"__gc", "__mode", "__len", "__eq",
"__add", "__sub", "__mul", "__div", "__mod",
"__pow", "__unm", "__lt", "__le",
"__concat", "__call"
};
int i;
for (i=0; i<TM_N; i++) {
G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
luaS_fix(G(L)->tmname[i]); /* never collect these names */
}
}
/*
** function to be used with macro "fasttm": optimized for absence of
** tag methods
*/
const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
const TValue *tm = luaH_getstr(events, ename);
lua_assert(event <= TM_EQ);
if (ttisnil(tm)) { /* no tag method? */
events->flags |= cast_byte(1u<<event); /* cache this fact */
return NULL;
}
else return tm;
}
const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
Table *mt;
switch (ttypenv(o)) {
case LUA_TTABLE:
mt = hvalue(o)->metatable;
break;
case LUA_TUSERDATA:
mt = uvalue(o)->metatable;
break;
default:
mt = G(L)->mt[ttypenv(o)];
}
return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
}

Some files were not shown because too many files have changed in this diff Show More