diff --git a/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp b/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp index f253fac2be4..3689b14a39c 100644 --- a/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp +++ b/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp @@ -495,6 +495,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: vs_metaballs = bgfx::makeRef(vs_metaballs_dx11, sizeof(vs_metaballs_dx11) ); fs_metaballs = bgfx::makeRef(fs_metaballs_dx11, sizeof(fs_metaballs_dx11) ); break; @@ -544,7 +545,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) float at[3] = { 0.0f, 0.0f, 0.0f }; float eye[3] = { 0.0f, 0.0f, -50.0f }; - + // Set view and projection matrix for view 0. const bgfx::HMD* hmd = bgfx::getHMD(); if (NULL != hmd) @@ -598,7 +599,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) } profUpdate = bx::getHPCounter(); - + for (uint32_t zz = 0; zz < DIMS; ++zz) { for (uint32_t yy = 0; yy < DIMS; ++yy) @@ -690,7 +691,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) -DIMS*0.5f + float(zz) }; - const Grid* val[8] = { + const Grid* val[8] = { &grid[xoffset+zpitch+ypitch ], &grid[xoffset+zpitch+ypitch+1], &grid[xoffset+ypitch+1 ], @@ -735,7 +736,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) bgfx::dbgTextPrintf(1, 7, 0x0f, " Triangulate: % 7.3f[ms]", double(profTriangulate)*toMs); bgfx::dbgTextPrintf(1, 8, 0x0f, " Frame: % 7.3f[ms]", double(frameTime)*toMs); - // 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(); } diff --git a/3rdparty/bgfx/examples/13-stencil/stencil.cpp b/3rdparty/bgfx/examples/13-stencil/stencil.cpp index a20124d068b..a9f62402e54 100644 --- a/3rdparty/bgfx/examples/13-stencil/stencil.cpp +++ b/3rdparty/bgfx/examples/13-stencil/stencil.cpp @@ -146,7 +146,6 @@ static const uint16_t s_planeIndices[] = 1, 3, 2, }; -static const char* s_shaderPath = NULL; static bool s_flipV = false; static uint32_t s_viewMask = 0; static uint32_t s_clearMask = 0; @@ -857,23 +856,12 @@ int _main_(int /*_argc*/, char** /*_argv*/) // for each renderer. switch (bgfx::getRendererType() ) { - default: - case bgfx::RendererType::Direct3D9: - s_shaderPath = "shaders/dx9/"; - break; - - case bgfx::RendererType::Direct3D11: - s_shaderPath = "shaders/dx11/"; - break; - case bgfx::RendererType::OpenGL: - s_shaderPath = "shaders/glsl/"; + case bgfx::RendererType::OpenGLES: s_flipV = true; break; - case bgfx::RendererType::OpenGLES: - s_shaderPath = "shaders/gles/"; - s_flipV = true; + default: break; } diff --git a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp index aa0f8bccb75..e6a79456de3 100644 --- a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp @@ -111,7 +111,6 @@ static const uint16_t s_planeIndices[] = 1, 3, 2, }; -static const char* s_shaderPath = NULL; static bool s_oglNdc = false; static float s_texelHalf = 0.0f; @@ -1872,24 +1871,16 @@ int _main_(int /*_argc*/, char** /*_argv*/) // for each renderer. switch (bgfx::getRendererType() ) { - default: case bgfx::RendererType::Direct3D9: - s_shaderPath = "shaders/dx9/"; s_texelHalf = 0.5f; break; - case bgfx::RendererType::Direct3D11: - s_shaderPath = "shaders/dx11/"; - break; - case bgfx::RendererType::OpenGL: - s_shaderPath = "shaders/glsl/"; + case bgfx::RendererType::OpenGLES: s_oglNdc = true; break; - case bgfx::RendererType::OpenGLES: - s_shaderPath = "shaders/gles/"; - s_oglNdc = true; + default: break; } diff --git a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp index 1589290de77..86b3d7082f6 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp +++ b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp @@ -220,7 +220,6 @@ static const uint16_t s_planeIndices[] = 1, 3, 2, }; -static const char* s_shaderPath = NULL; static bool s_flipV = false; static float s_texelHalf = 0.0f; @@ -1333,24 +1332,16 @@ int _main_(int /*_argc*/, char** /*_argv*/) // for each renderer. switch (bgfx::getRendererType() ) { - default: case bgfx::RendererType::Direct3D9: - s_shaderPath = "shaders/dx9/"; s_texelHalf = 0.5f; break; - case bgfx::RendererType::Direct3D11: - s_shaderPath = "shaders/dx11/"; - break; - case bgfx::RendererType::OpenGL: - s_shaderPath = "shaders/glsl/"; + case bgfx::RendererType::OpenGLES: s_flipV = true; break; - case bgfx::RendererType::OpenGLES: - s_shaderPath = "shaders/gles/"; - s_flipV = true; + default: break; } diff --git a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp index 93a1bc925f4..4310151479b 100644 --- a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp +++ b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp @@ -280,6 +280,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: vs_drawstress = bgfx::makeRef(vs_drawstress_dx11, sizeof(vs_drawstress_dx11) ); fs_drawstress = bgfx::makeRef(fs_drawstress_dx11, sizeof(fs_drawstress_dx11) ); break; diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp index 0035076d88b..a638e4e7d4b 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp +++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp @@ -71,6 +71,7 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name switch (bgfx::getRendererType() ) { case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: shaderPath = "shaders/dx11/"; break; diff --git a/3rdparty/bgfx/examples/common/cube_atlas.cpp b/3rdparty/bgfx/examples/common/cube_atlas.cpp index 15d91b98f9e..6928338a642 100644 --- a/3rdparty/bgfx/examples/common/cube_atlas.cpp +++ b/3rdparty/bgfx/examples/common/cube_atlas.cpp @@ -60,8 +60,8 @@ private: int32_t width; //< The line _width. The ending coordinate (inclusive) will be x+width-1. }; - - uint32_t m_width; //< width (in pixels) of the underlying texture + + uint32_t m_width; //< width (in pixels) of the underlying texture uint32_t m_height; //< height (in pixels) of the underlying texture uint32_t m_usedSpace; //< Surface used in squared pixel std::vector m_skyline; //< node of the skyline algorithm @@ -326,6 +326,7 @@ void Atlas::init() break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: m_texelOffset[0] = texelHalf; m_texelOffset[1] = texelHalf; break; diff --git a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp index 654d1cabec1..f3dd51342db 100644 --- a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp +++ b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp @@ -74,7 +74,7 @@ public: /// Append a wide char unicode string to the buffer using current pen /// position and color. void appendText(FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end = NULL); - + /// Append a whole face of the atlas cube, mostly used for debugging /// and visualizing atlas. void appendAtlasFace(uint16_t _faceIndex); @@ -250,7 +250,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c } } - BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed"); + BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed"); } void TextBuffer::appendText(FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end) @@ -366,7 +366,7 @@ void TextBuffer::appendGlyph(FontHandle _handle, CodePoint _codePoint) float txtDecals = (font.ascender - m_lineAscender); m_lineAscender = font.ascender; - m_lineGap = font.lineGap; + m_lineGap = font.lineGap; verticalCenterLastLine( (txtDecals), (m_penY - m_lineAscender), (m_penY + m_lineAscender - m_lineDescender + m_lineGap) ); } @@ -575,6 +575,7 @@ TextBufferManager::TextBufferManager(FontManager* _fontManager) break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: vs_font_basic = bgfx::makeRef(vs_font_basic_dx11, sizeof(vs_font_basic_dx11) ); fs_font_basic = bgfx::makeRef(fs_font_basic_dx11, sizeof(fs_font_basic_dx11) ); vs_font_distance_field = bgfx::makeRef(vs_font_distance_field_dx11, sizeof(vs_font_distance_field_dx11) ); diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index 805b60b0536..9e8039d3958 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -468,9 +468,9 @@ struct Imgui IMGUI_create(_data, _size, _fontSize); m_nvg = nvgCreate(1, m_view); - nvgCreateFontMem(m_nvg, "default", (unsigned char*)_data, INT32_MAX, 0); - nvgFontSize(m_nvg, _fontSize); - nvgFontFace(m_nvg, "default"); + nvgCreateFontMem(m_nvg, "default", (unsigned char*)_data, INT32_MAX, 0); + nvgFontSize(m_nvg, _fontSize); + nvgFontFace(m_nvg, "default"); for (int32_t ii = 0; ii < NUM_CIRCLE_VERTS; ++ii) { @@ -518,6 +518,7 @@ struct Imgui break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: vs_imgui_color = bgfx::makeRef(vs_imgui_color_dx11, sizeof(vs_imgui_color_dx11) ); fs_imgui_color = bgfx::makeRef(fs_imgui_color_dx11, sizeof(fs_imgui_color_dx11) ); vs_imgui_texture = bgfx::makeRef(vs_imgui_texture_dx11, sizeof(vs_imgui_texture_dx11) ); diff --git a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp index 90998095d12..9df3b28c62b 100644 --- a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp @@ -99,6 +99,7 @@ struct OcornutImguiContext break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: vsmem = bgfx::makeRef(vs_ocornut_imgui_dx11, sizeof(vs_ocornut_imgui_dx11)); fsmem = bgfx::makeRef(fs_ocornut_imgui_dx11, sizeof(fs_ocornut_imgui_dx11)); break; diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index 09de7e7286c..40a1fbe8418 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -239,6 +239,7 @@ namespace break; case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: vs_nanovg_fill = bgfx::makeRef(vs_nanovg_fill_dx11, sizeof(vs_nanovg_fill_dx11) ); fs_nanovg_fill = bgfx::makeRef(fs_nanovg_fill_dx11, sizeof(fs_nanovg_fill_dx11) ); break; diff --git a/3rdparty/bgfx/examples/common/shaderlib.sh b/3rdparty/bgfx/examples/common/shaderlib.sh index 8f1d30eb3eb..b8915d16c5a 100644 --- a/3rdparty/bgfx/examples/common/shaderlib.sh +++ b/3rdparty/bgfx/examples/common/shaderlib.sh @@ -183,6 +183,19 @@ vec4 toLinear(vec4 _rgba) return vec4(toLinear(_rgba.xyz), _rgba.w); } +vec3 toLinearAccurate(vec3 _rgb) +{ + vec3 lo = _rgb / 12.92; + vec3 hi = pow( (_rgb + 0.055) / 1.055, vec3_splat(2.4) ); + vec3 rgb = mix(hi, lo, vec3(lessThanEqual(_rgb, vec3_splat(0.04045) ) ) ); + return rgb; +} + +vec4 toLinearAccurate(vec4 _rgba) +{ + return vec4(toLinearAccurate(_rgba.xyz), _rgba.w); +} + float toGamma(float _r) { return pow(abs(_r), 1.0/2.2); @@ -198,6 +211,19 @@ vec4 toGamma(vec4 _rgba) return vec4(toGamma(_rgba.xyz), _rgba.w); } +vec3 toGammaAccurate(vec3 _rgb) +{ + vec3 lo = _rgb * 12.92; + vec3 hi = pow(abs(_rgb), vec3_splat(1.0/2.4) ) * 1.055 - 0.055; + vec3 rgb = mix(hi, lo, vec3(lessThanEqual(_rgb, vec3_splat(0.0031308) ) ) ); + return rgb; +} + +vec4 toGammaAccurate(vec4 _rgba) +{ + return vec4(toGammaAccurate(_rgba.xyz), _rgba.w); +} + vec3 toReinhard(vec3 _rgb) { return toGamma(_rgb/(_rgb+vec3_splat(1.0) ) ); diff --git a/3rdparty/bgfx/include/bgfx.c99.h b/3rdparty/bgfx/include/bgfx.c99.h index df1930e5f5a..f5a6fa7b053 100644 --- a/3rdparty/bgfx/include/bgfx.c99.h +++ b/3rdparty/bgfx/include/bgfx.c99.h @@ -725,7 +725,7 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand * @param _num Number of vertices. * @param _decl Vertex declaration. */ -BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags); +BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags); /** * Create dynamic vertex buffer and initialize it. @@ -816,7 +816,7 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_ * NOTE: * Only 16-bit index buffer is supported. */ -BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices); +BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); /** * Allocate instance data buffer. diff --git a/3rdparty/bgfx/include/bgfx.h b/3rdparty/bgfx/include/bgfx.h index 31bf19a6fbc..3ac048888a6 100644 --- a/3rdparty/bgfx/include/bgfx.h +++ b/3rdparty/bgfx/include/bgfx.h @@ -46,7 +46,8 @@ namespace bgfx Null, //!< No rendering. Direct3D9, //!< Direct3D 9.0 Direct3D11, //!< Direct3D 11.0 - OpenGLES = 4, //!< OpenGL ES 2.0+ + Direct3D12, //!< Direct3D 12.0 + OpenGLES, //!< OpenGL ES 2.0+ OpenGL, //!< OpenGL 2.1+ Count @@ -686,7 +687,7 @@ namespace bgfx /// When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated /// from CPU. /// - DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE); + DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE); /// Create dynamic vertex buffer and initialize it. /// @@ -765,7 +766,7 @@ namespace bgfx /// @remarks /// Only 16-bit index buffer is supported. /// - bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint16_t _numVertices, TransientIndexBuffer* _tib, uint16_t _numIndices); + bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint32_t _numVertices, TransientIndexBuffer* _tib, uint32_t _numIndices); /// Allocate instance data buffer. /// diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index 35320e1a48f..c550500aa56 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -355,6 +355,7 @@ namespace bgfx break; case RendererType::Direct3D11: + case RendererType::Direct3D12: mem = makeRef(vs_debugfont_dx11, sizeof(vs_debugfont_dx11) ); break; @@ -372,6 +373,7 @@ namespace bgfx break; case RendererType::Direct3D11: + case RendererType::Direct3D12: mem = makeRef(fs_debugfont_dx11, sizeof(fs_debugfont_dx11) ); break; @@ -552,7 +554,8 @@ namespace bgfx fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) ); } } - else if (RendererType::Direct3D11 == g_caps.rendererType) + else if (RendererType::Direct3D11 == g_caps.rendererType + || RendererType::Direct3D12 == g_caps.rendererType) { vsh = createShader(makeRef(vs_clear_dx11, sizeof(vs_clear_dx11) ) ); @@ -772,7 +775,7 @@ namespace bgfx { m_key.m_depth = 0; m_key.m_view = _id; - m_key.m_seq = s_ctx->m_seq[_id] & s_ctx->m_seqMask[_id]; + m_key.m_seq = s_ctx->m_seq[_id]; s_ctx->m_seq[_id]++; uint64_t key = m_key.encodeCompute(); @@ -1391,10 +1394,12 @@ again: if (windowsVersionIs(Condition::GreaterEqual, 0x0602) ) { - first = RendererType::Direct3D11 /* Direct3D12 */; + first = RendererType::Direct3D12; second = RendererType::Direct3D11; if (!s_rendererCreator[second].supported) + { second = RendererType::Direct3D9; + } } else if (windowsVersionIs(Condition::GreaterEqual, 0x0601) ) { @@ -1926,7 +1931,7 @@ again: uint8_t num = 0; for (uint8_t ii = 0; ii < uint8_t(RendererType::Count); ++ii) { - if (RendererType::Direct3D11 == ii + if ( (RendererType::Direct3D11 == ii || RendererType::Direct3D12 == ii) && windowsVersionIs(Condition::LessEqual, 0x0502) ) { continue; @@ -2161,7 +2166,7 @@ again: s_ctx->destroyDynamicIndexBuffer(_handle); } - DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags) + DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags) { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl."); @@ -2237,7 +2242,7 @@ again: return s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl); } - bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint16_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint16_t _numIndices) + bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices) { if (checkAvailTransientBuffers(_numVertices, _decl, _numIndices) ) { @@ -3095,7 +3100,7 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand bgfx::destroyDynamicIndexBuffer(handle.cpp); } -BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags) +BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags) { const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl; union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle; @@ -3156,7 +3161,7 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_ bgfx::allocTransientVertexBuffer( (bgfx::TransientVertexBuffer*)_tvb, _num, decl); } -BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices) +BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices) { const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl; return bgfx::allocTransientBuffers( (bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices); diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index e158b6021bd..feced94a50e 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -2178,7 +2178,7 @@ namespace bgfx return ptr; } - BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags) ) + BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags) ) { DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE; uint32_t size = strideAlign16( (_num+1)*_decl.m_stride, _decl.m_stride); @@ -2906,6 +2906,15 @@ namespace bgfx if (0 == refs) { + for (UniformHashMap::iterator it = m_uniformHashMap.begin(), itEnd = m_uniformHashMap.end(); it != itEnd; ++it) + { + if (it->second.idx == _handle.idx) + { + m_uniformHashMap.erase(it); + break; + } + } + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyUniform); cmdbuf.write(_handle); m_submit->free(_handle); diff --git a/3rdparty/bgfx/src/glcontext_egl.cpp b/3rdparty/bgfx/src/glcontext_egl.cpp index 9ef95846fef..1a70e37b720 100644 --- a/3rdparty/bgfx/src/glcontext_egl.cpp +++ b/3rdparty/bgfx/src/glcontext_egl.cpp @@ -254,6 +254,7 @@ EGL_IMPORT success = eglMakeCurrent(m_display, m_surface, m_surface, m_context); BGFX_FATAL(success, Fatal::UnableToInitialize, "Failed to set context."); + m_current = NULL; eglSwapInterval(m_display, 0); @@ -311,27 +312,32 @@ EGL_IMPORT void GlContext::swap(SwapChainGL* _swapChain) { + makeCurrent(_swapChain); + if (NULL == _swapChain) { - eglMakeCurrent(m_display, m_surface, m_surface, m_context); eglSwapBuffers(m_display, m_surface); } else { - _swapChain->makeCurrent(); _swapChain->swapBuffers(); } } void GlContext::makeCurrent(SwapChainGL* _swapChain) { - if (NULL == _swapChain) + if (m_current != _swapChain) { - eglMakeCurrent(m_display, m_surface, m_surface, m_context); - } - else - { - _swapChain->makeCurrent(); + m_current = _swapChain; + + if (NULL == _swapChain) + { + eglMakeCurrent(m_display, m_surface, m_surface, m_context); + } + else + { + _swapChain->makeCurrent(); + } } } diff --git a/3rdparty/bgfx/src/glcontext_egl.h b/3rdparty/bgfx/src/glcontext_egl.h index e18aaa71211..98fd63f7928 100644 --- a/3rdparty/bgfx/src/glcontext_egl.h +++ b/3rdparty/bgfx/src/glcontext_egl.h @@ -17,7 +17,8 @@ namespace bgfx struct GlContext { GlContext() - : m_context(NULL) + : m_current(NULL) + , m_context(NULL) , m_display(NULL) , m_surface(NULL) { @@ -41,6 +42,7 @@ namespace bgfx } void* m_eglLibrary; + SwapChainGL* m_current; EGLConfig m_config; EGLContext m_context; EGLDisplay m_display; diff --git a/3rdparty/bgfx/src/glcontext_glx.cpp b/3rdparty/bgfx/src/glcontext_glx.cpp index 1168672cffb..af40d2d9413 100644 --- a/3rdparty/bgfx/src/glcontext_glx.cpp +++ b/3rdparty/bgfx/src/glcontext_glx.cpp @@ -175,6 +175,7 @@ namespace bgfx import(); glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context); + m_current = NULL; glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalEXT"); if (NULL != glXSwapIntervalEXT) @@ -248,27 +249,32 @@ namespace bgfx void GlContext::swap(SwapChainGL* _swapChain) { + makeCurrent(_swapChain); + if (NULL == _swapChain) { - glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context); glXSwapBuffers( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window); } else { - _swapChain->makeCurrent(); _swapChain->swapBuffers(); } } void GlContext::makeCurrent(SwapChainGL* _swapChain) { - if (NULL == _swapChain) + if (m_current != _swapChain) { - glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context); - } - else - { - _swapChain->makeCurrent(); + m_current = _swapChain; + + if (NULL == _swapChain) + { + glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context); + } + else + { + _swapChain->makeCurrent(); + } } } diff --git a/3rdparty/bgfx/src/glcontext_glx.h b/3rdparty/bgfx/src/glcontext_glx.h index 556f10b25c1..3fa7dbf2a64 100644 --- a/3rdparty/bgfx/src/glcontext_glx.h +++ b/3rdparty/bgfx/src/glcontext_glx.h @@ -18,7 +18,8 @@ namespace bgfx struct GlContext { GlContext() - : m_context(0) + : m_current(NULL) + , m_context(0) , m_visualInfo(NULL) { } @@ -40,6 +41,7 @@ namespace bgfx return 0 != m_context; } + SwapChainGL* m_current; GLXContext m_context; XVisualInfo* m_visualInfo; }; diff --git a/3rdparty/bgfx/src/glcontext_wgl.cpp b/3rdparty/bgfx/src/glcontext_wgl.cpp index 85a8fe2b1b3..56aad127514 100644 --- a/3rdparty/bgfx/src/glcontext_wgl.cpp +++ b/3rdparty/bgfx/src/glcontext_wgl.cpp @@ -184,7 +184,7 @@ namespace bgfx int result; uint32_t numFormats = 0; - do + do { result = wglChoosePixelFormatARB(m_hdc, attrs, NULL, 1, &m_pixelFormat, &numFormats); if (0 == result @@ -259,6 +259,7 @@ namespace bgfx int result = wglMakeCurrent(m_hdc, m_context); BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!"); + m_current = NULL; if (NULL != wglSwapIntervalEXT) { @@ -316,37 +317,42 @@ namespace bgfx BX_DELETE(g_allocator, _swapChain); } - void GlContext::makeCurrent(SwapChainGL* _swapChain) - { - if (NULL == _swapChain) - { - wglMakeCurrent(m_hdc, m_context); - GLenum err = glGetError(); - BX_WARN(0 == err, "wglMakeCurrent failed with GL error: 0x%04x.", err); BX_UNUSED(err); - } - else - { - _swapChain->makeCurrent(); - } - } - void GlContext::swap(SwapChainGL* _swapChain) { + makeCurrent(_swapChain); + if (NULL == _swapChain) { if (NULL != g_bgfxHwnd) { - wglMakeCurrent(m_hdc, m_context); SwapBuffers(m_hdc); } } else { - _swapChain->makeCurrent(); _swapChain->swapBuffers(); } } + void GlContext::makeCurrent(SwapChainGL* _swapChain) + { + if (m_current != _swapChain) + { + m_current = _swapChain; + + if (NULL == _swapChain) + { + wglMakeCurrent(m_hdc, m_context); + GLenum err = glGetError(); + BX_WARN(0 == err, "wglMakeCurrent failed with GL error: 0x%04x.", err); BX_UNUSED(err); + } + else + { + _swapChain->makeCurrent(); + } + } + } + void GlContext::import() { BX_TRACE("Import:"); diff --git a/3rdparty/bgfx/src/glcontext_wgl.h b/3rdparty/bgfx/src/glcontext_wgl.h index cda9c1499cc..4d0f64fb281 100644 --- a/3rdparty/bgfx/src/glcontext_wgl.h +++ b/3rdparty/bgfx/src/glcontext_wgl.h @@ -61,7 +61,8 @@ typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum z struct GlContext { GlContext() - : m_opengl32dll(NULL) + : m_current(NULL) + , m_opengl32dll(NULL) , m_context(NULL) , m_hdc(NULL) { @@ -87,6 +88,7 @@ typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum z int32_t m_contextAttrs[9]; int m_pixelFormat; PIXELFORMATDESCRIPTOR m_pfd; + SwapChainGL* m_current; void* m_opengl32dll; HGLRC m_context; HDC m_hdc; diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie index b8d2810cf59..865e7d8cf47 100644 Binary files a/3rdparty/bx/tools/bin/darwin/genie and b/3rdparty/bx/tools/bin/darwin/genie differ diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie index 0f7ae461996..b8cf8cc08e3 100644 Binary files a/3rdparty/bx/tools/bin/linux/genie and b/3rdparty/bx/tools/bin/linux/genie differ diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe index de1a09d8c19..6b03902d33c 100644 Binary files a/3rdparty/bx/tools/bin/windows/genie.exe and b/3rdparty/bx/tools/bin/windows/genie.exe differ diff --git a/3rdparty/genie/README.md b/3rdparty/genie/README.md index 7345b13653b..1269aeb30c3 100644 --- a/3rdparty/genie/README.md +++ b/3rdparty/genie/README.md @@ -14,7 +14,7 @@ Supported project generators: Download (stable) ----------------- - version 178 (commit f9ef54d6a5fa3421d141b8fe53683fe1a0fbd9cc) + version 181 (commit 6b59593a0a812fea6c5caaf6a50772076a6e5637) Linux: https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie diff --git a/3rdparty/genie/build/gmake.darwin/genie.make b/3rdparty/genie/build/gmake.darwin/genie.make index b28276f823c..328b7e2b067 100644 --- a/3rdparty/genie/build/gmake.darwin/genie.make +++ b/3rdparty/genie/build/gmake.darwin/genie.make @@ -19,7 +19,7 @@ ifeq (posix,$(SHELLTYPE)) MKDIR = $(SILENT) mkdir -p "$(1)" COPY = $(SILENT) cp -fR "$(1)" "$(2)" else - MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || true + MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || exit 0 COPY = $(SILENT) copy /Y "$(subst /,\\,$(1))" "$(subst /,\\,$(2))" endif @@ -49,81 +49,7 @@ ifeq ($(config),release) LDDEPS += LIBS += $(LDDEPS) -framework CoreServices LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -ifeq ($(config),debug) - OBJDIR = obj/Debug - TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie - DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX - INCLUDES += -I../../src/host/lua-5.2.3/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) $(ALL_CFLAGS) - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - ALL_LDFLAGS += $(LDFLAGS) -L. -mmacosx-version-min=10.4 - LDDEPS += - LIBS += $(LDDEPS) -framework CoreServices - LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -ifeq ($(config),releaseuniv32) - OBJDIR = obj/Universal32/Release - TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie - DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX - INCLUDES += -I../../src/host/lua-5.2.3/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) $(ALL_CFLAGS) - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - ALL_LDFLAGS += $(LDFLAGS) -L. -Wl,-x -arch i386 -arch ppc -mmacosx-version-min=10.4 - LDDEPS += - LIBS += $(LDDEPS) -framework CoreServices - LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -ifeq ($(config),debuguniv32) - OBJDIR = obj/Universal32/Debug - TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie - DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX - INCLUDES += -I../../src/host/lua-5.2.3/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) $(ALL_CFLAGS) - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - ALL_LDFLAGS += $(LDFLAGS) -L. -arch i386 -arch ppc -mmacosx-version-min=10.4 - LDDEPS += - LIBS += $(LDDEPS) -framework CoreServices - LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -OBJECTS := \ + OBJECTS := \ $(OBJDIR)/src/host/os_isfile.o \ $(OBJDIR)/src/host/os_stat.o \ $(OBJDIR)/src/host/os_rmdir.o \ @@ -176,6 +102,239 @@ OBJECTS := \ $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + +ifeq ($(config),debug) + OBJDIR = obj/Debug + TARGETDIR = ../../bin/darwin + TARGET = $(TARGETDIR)/genie + DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX + INCLUDES += -I../../src/host/lua-5.2.3/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) $(ALL_CFLAGS) + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) + ALL_LDFLAGS += $(LDFLAGS) -L. -mmacosx-version-min=10.4 + LDDEPS += + LIBS += $(LDDEPS) -framework CoreServices + LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + OBJECTS := \ + $(OBJDIR)/src/host/os_isfile.o \ + $(OBJDIR)/src/host/os_stat.o \ + $(OBJDIR)/src/host/os_rmdir.o \ + $(OBJDIR)/src/host/os_copyfile.o \ + $(OBJDIR)/src/host/string_hash.o \ + $(OBJDIR)/src/host/os_chdir.o \ + $(OBJDIR)/src/host/os_is64bit.o \ + $(OBJDIR)/src/host/os_match.o \ + $(OBJDIR)/src/host/scripts.o \ + $(OBJDIR)/src/host/string_endswith.o \ + $(OBJDIR)/src/host/os_mkdir.o \ + $(OBJDIR)/src/host/os_getversion.o \ + $(OBJDIR)/src/host/premake_main.o \ + $(OBJDIR)/src/host/path_isabsolute.o \ + $(OBJDIR)/src/host/premake.o \ + $(OBJDIR)/src/host/os_isdir.o \ + $(OBJDIR)/src/host/os_uuid.o \ + $(OBJDIR)/src/host/os_pathsearch.o \ + $(OBJDIR)/src/host/os_getcwd.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/linit.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/llex.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + +ifeq ($(config),releaseuniv32) + OBJDIR = obj/Universal32/Release + TARGETDIR = ../../bin/darwin + TARGET = $(TARGETDIR)/genie + DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX + INCLUDES += -I../../src/host/lua-5.2.3/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) $(ALL_CFLAGS) + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) + ALL_LDFLAGS += $(LDFLAGS) -L. -Wl,-x -arch i386 -arch ppc -mmacosx-version-min=10.4 + LDDEPS += + LIBS += $(LDDEPS) -framework CoreServices + LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + OBJECTS := \ + $(OBJDIR)/src/host/os_isfile.o \ + $(OBJDIR)/src/host/os_stat.o \ + $(OBJDIR)/src/host/os_rmdir.o \ + $(OBJDIR)/src/host/os_copyfile.o \ + $(OBJDIR)/src/host/string_hash.o \ + $(OBJDIR)/src/host/os_chdir.o \ + $(OBJDIR)/src/host/os_is64bit.o \ + $(OBJDIR)/src/host/os_match.o \ + $(OBJDIR)/src/host/scripts.o \ + $(OBJDIR)/src/host/string_endswith.o \ + $(OBJDIR)/src/host/os_mkdir.o \ + $(OBJDIR)/src/host/os_getversion.o \ + $(OBJDIR)/src/host/premake_main.o \ + $(OBJDIR)/src/host/path_isabsolute.o \ + $(OBJDIR)/src/host/premake.o \ + $(OBJDIR)/src/host/os_isdir.o \ + $(OBJDIR)/src/host/os_uuid.o \ + $(OBJDIR)/src/host/os_pathsearch.o \ + $(OBJDIR)/src/host/os_getcwd.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/linit.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/llex.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + +ifeq ($(config),debuguniv32) + OBJDIR = obj/Universal32/Debug + TARGETDIR = ../../bin/darwin + TARGET = $(TARGETDIR)/genie + DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX + INCLUDES += -I../../src/host/lua-5.2.3/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) $(ALL_CFLAGS) + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) + ALL_LDFLAGS += $(LDFLAGS) -L. -arch i386 -arch ppc -mmacosx-version-min=10.4 + LDDEPS += + LIBS += $(LDDEPS) -framework CoreServices + LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + OBJECTS := \ + $(OBJDIR)/src/host/os_isfile.o \ + $(OBJDIR)/src/host/os_stat.o \ + $(OBJDIR)/src/host/os_rmdir.o \ + $(OBJDIR)/src/host/os_copyfile.o \ + $(OBJDIR)/src/host/string_hash.o \ + $(OBJDIR)/src/host/os_chdir.o \ + $(OBJDIR)/src/host/os_is64bit.o \ + $(OBJDIR)/src/host/os_match.o \ + $(OBJDIR)/src/host/scripts.o \ + $(OBJDIR)/src/host/string_endswith.o \ + $(OBJDIR)/src/host/os_mkdir.o \ + $(OBJDIR)/src/host/os_getversion.o \ + $(OBJDIR)/src/host/premake_main.o \ + $(OBJDIR)/src/host/path_isabsolute.o \ + $(OBJDIR)/src/host/premake.o \ + $(OBJDIR)/src/host/os_isdir.o \ + $(OBJDIR)/src/host/os_uuid.o \ + $(OBJDIR)/src/host/os_pathsearch.o \ + $(OBJDIR)/src/host/os_getcwd.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/linit.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/llex.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + OBJDIRS := \ $(OBJDIR) \ $(OBJDIR)/src/host \ diff --git a/3rdparty/genie/build/gmake.linux/genie.make b/3rdparty/genie/build/gmake.linux/genie.make index 7642956a719..336bc48182f 100644 --- a/3rdparty/genie/build/gmake.linux/genie.make +++ b/3rdparty/genie/build/gmake.linux/genie.make @@ -19,7 +19,7 @@ ifeq (posix,$(SHELLTYPE)) MKDIR = $(SILENT) mkdir -p "$(1)" COPY = $(SILENT) cp -fR "$(1)" "$(2)" else - MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || true + MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || exit 0 COPY = $(SILENT) copy /Y "$(subst /,\\,$(1))" "$(subst /,\\,$(2))" endif @@ -49,37 +49,7 @@ ifeq ($(config),release) LDDEPS += LIBS += $(LDDEPS) -ldl -lm LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -ifeq ($(config),debug) - OBJDIR = obj/Debug - TARGETDIR = ../../bin/linux - TARGET = $(TARGETDIR)/genie - DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_POSIX -DLUA_USE_DLOPEN - INCLUDES += -I../../src/host/lua-5.2.3/src - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - ALL_LDFLAGS += $(LDFLAGS) -L. -rdynamic - LDDEPS += - LIBS += $(LDDEPS) -ldl -lm - LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -OBJECTS := \ + OBJECTS := \ $(OBJDIR)/src/host/os_isfile.o \ $(OBJDIR)/src/host/os_stat.o \ $(OBJDIR)/src/host/os_rmdir.o \ @@ -132,6 +102,89 @@ OBJECTS := \ $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + +ifeq ($(config),debug) + OBJDIR = obj/Debug + TARGETDIR = ../../bin/linux + TARGET = $(TARGETDIR)/genie + DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_POSIX -DLUA_USE_DLOPEN + INCLUDES += -I../../src/host/lua-5.2.3/src + ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) + ALL_LDFLAGS += $(LDFLAGS) -L. -rdynamic + LDDEPS += + LIBS += $(LDDEPS) -ldl -lm + LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + OBJECTS := \ + $(OBJDIR)/src/host/os_isfile.o \ + $(OBJDIR)/src/host/os_stat.o \ + $(OBJDIR)/src/host/os_rmdir.o \ + $(OBJDIR)/src/host/os_copyfile.o \ + $(OBJDIR)/src/host/string_hash.o \ + $(OBJDIR)/src/host/os_chdir.o \ + $(OBJDIR)/src/host/os_is64bit.o \ + $(OBJDIR)/src/host/os_match.o \ + $(OBJDIR)/src/host/scripts.o \ + $(OBJDIR)/src/host/string_endswith.o \ + $(OBJDIR)/src/host/os_mkdir.o \ + $(OBJDIR)/src/host/os_getversion.o \ + $(OBJDIR)/src/host/premake_main.o \ + $(OBJDIR)/src/host/path_isabsolute.o \ + $(OBJDIR)/src/host/premake.o \ + $(OBJDIR)/src/host/os_isdir.o \ + $(OBJDIR)/src/host/os_uuid.o \ + $(OBJDIR)/src/host/os_pathsearch.o \ + $(OBJDIR)/src/host/os_getcwd.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/linit.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/llex.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + OBJDIRS := \ $(OBJDIR) \ $(OBJDIR)/src/host \ diff --git a/3rdparty/genie/build/gmake.windows/genie.make b/3rdparty/genie/build/gmake.windows/genie.make index ac042bc8b78..7d6de8b1953 100644 --- a/3rdparty/genie/build/gmake.windows/genie.make +++ b/3rdparty/genie/build/gmake.windows/genie.make @@ -19,7 +19,7 @@ ifeq (posix,$(SHELLTYPE)) MKDIR = $(SILENT) mkdir -p "$(1)" COPY = $(SILENT) cp -fR "$(1)" "$(2)" else - MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || true + MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || exit 0 COPY = $(SILENT) copy /Y "$(subst /,\\,$(1))" "$(subst /,\\,$(2))" endif @@ -49,37 +49,7 @@ ifeq ($(config),release) LDDEPS += LIBS += $(LDDEPS) -lole32 LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -ifeq ($(config),debug) - OBJDIR = obj/Debug - TARGETDIR = ../../bin/windows - TARGET = $(TARGETDIR)/genie.exe - DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE - INCLUDES += -I../../src/host/lua-5.2.3/src - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - ALL_LDFLAGS += $(LDFLAGS) -L. - LDDEPS += - LIBS += $(LDDEPS) -lole32 - LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) - define PREBUILDCMDS - endef - define PRELINKCMDS - endef - define POSTBUILDCMDS - endef -endif - -OBJECTS := \ + OBJECTS := \ $(OBJDIR)/src/host/os_isfile.o \ $(OBJDIR)/src/host/os_stat.o \ $(OBJDIR)/src/host/os_rmdir.o \ @@ -132,10 +102,93 @@ OBJECTS := \ $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + +ifeq ($(config),debug) + OBJDIR = obj/Debug + TARGETDIR = ../../bin/windows + TARGET = $(TARGETDIR)/genie.exe + DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE + INCLUDES += -I../../src/host/lua-5.2.3/src + ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) + ALL_LDFLAGS += $(LDFLAGS) -L. + LDDEPS += + LIBS += $(LDDEPS) -lole32 + LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + OBJECTS := \ + $(OBJDIR)/src/host/os_isfile.o \ + $(OBJDIR)/src/host/os_stat.o \ + $(OBJDIR)/src/host/os_rmdir.o \ + $(OBJDIR)/src/host/os_copyfile.o \ + $(OBJDIR)/src/host/string_hash.o \ + $(OBJDIR)/src/host/os_chdir.o \ + $(OBJDIR)/src/host/os_is64bit.o \ + $(OBJDIR)/src/host/os_match.o \ + $(OBJDIR)/src/host/scripts.o \ + $(OBJDIR)/src/host/string_endswith.o \ + $(OBJDIR)/src/host/os_mkdir.o \ + $(OBJDIR)/src/host/os_getversion.o \ + $(OBJDIR)/src/host/premake_main.o \ + $(OBJDIR)/src/host/path_isabsolute.o \ + $(OBJDIR)/src/host/premake.o \ + $(OBJDIR)/src/host/os_isdir.o \ + $(OBJDIR)/src/host/os_uuid.o \ + $(OBJDIR)/src/host/os_pathsearch.o \ + $(OBJDIR)/src/host/os_getcwd.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbaselib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lvm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcorolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltablib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lobject.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lcode.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldo.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/liolib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltable.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loadlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lundump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/loslib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lfunc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/linit.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstate.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/llex.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldump.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstrlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmathlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lauxlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lopcodes.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lparser.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lapi.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldblib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lbitlib.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lgc.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ltm.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lzio.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lmem.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lctype.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/lstring.o \ + $(OBJDIR)/src/host/lua-5.2.3/src/ldebug.o \ + + define PREBUILDCMDS + endef + define PRELINKCMDS + endef + define POSTBUILDCMDS + endef +endif + OBJDIRS := \ $(OBJDIR) \ - $(OBJDIR)/src/host \ $(OBJDIR)/src/host/lua-5.2.3/src \ + $(OBJDIR)/src/host \ RESOURCES := \ @@ -156,8 +209,8 @@ $(TARGETDIR): $(OBJDIRS): @echo Creating $(OBJDIR) -$(call MKDIR,$(OBJDIR)) - -$(call MKDIR,$(OBJDIR)/src/host) -$(call MKDIR,$(OBJDIR)/src/host/lua-5.2.3/src) + -$(call MKDIR,$(OBJDIR)/src/host) clean: @echo Cleaning genie diff --git a/3rdparty/genie/src/actions/make/make_cpp.lua b/3rdparty/genie/src/actions/make/make_cpp.lua index e36bb41c05b..dbc22063739 100644 --- a/3rdparty/genie/src/actions/make/make_cpp.lua +++ b/3rdparty/genie/src/actions/make/make_cpp.lua @@ -193,7 +193,7 @@ _p(' MKDIR = $(SILENT) mkdir -p "$(1)"') _p(' COPY = $(SILENT) cp -fR "$(1)" "$(2)"') _p('else') - _p(' MKDIR = $(SILENT) mkdir "$(subst /,\\\\,$(1))" 2> nul || true') + _p(' MKDIR = $(SILENT) mkdir "$(subst /,\\\\,$(1))" 2> nul || exit 0') _p(' COPY = $(SILENT) copy /Y "$(subst /,\\\\,$(1))" "$(subst /,\\\\,$(2))"') _p('endif') _p('') diff --git a/3rdparty/genie/src/host/scripts.c b/3rdparty/genie/src/host/scripts.c index 6c4b0b9e805..a5ce08fcf75 100644 --- a/3rdparty/genie/src/host/scripts.c +++ b/3rdparty/genie/src/host/scripts.c @@ -183,12 +183,12 @@ const char* builtin_scripts[] = { "ebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\nelse\n_p('all: $(TARGETDIR) $(OBJDIRS) prebuild prelink $(TARGET)')\nend\n_p('\\t@:')\n_p('')\nif (prj.kind == \"StaticLib\" and prj.options.ArchiveSplit) then\n_p('define max_args')\n_p('\\t$(eval _args:=)')\n_p('\\t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))')\n_p('\\t$(if $(_args),$1$(_args))')\n_p('endef')\n_p('')\n_p('define EOL')\n_p('')\n_p('')\n_p('endef')\n_p('')\nend\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')\nif prj.kind == \"StaticLib\" then\nif prj.msgarchiving then\n_p('\\t@echo ' .. prj.msgarchiving)\nelse\n_p('\\t@echo Archiving %s', prj.name)\nend\nif (not prj.archivesplit_size) then \nprj.archivesplit_size=200\nend\nif (not prj.options.ArchiveSplit) then\n_p('\\t$(SILENT) $(LINKCMD) $(OBJECTS)')\nelse\n_p('\\t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(OBJECTS))')\nend\nelse\nif prj.msglinking then\n_p('\\t@echo ' .. prj.msgl" "inking)\nelse\n_p('\\t@echo Linking %s', prj.name)\nend\n_p('\\t$(SILENT) $(LINKCMD)')\nend\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIRS):')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCreatingMessage\")) then\n_p('\\t@echo Creating $(OBJDIR)')\nend\n_p('\\t-$(call MKDIR,$(OBJDIR))')\nfor dir, _ in pairs(objdirs) do\n_p('\\t-$(call MKDIR,$(OBJDIR)/%s)', dir)\nend\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t" "$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj)\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(" - "SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || true')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(cfg, cc)\n_p(' OBJECTS := \\\\')\nfor _, file" - " in ipairs(prj.files) do\nif path.iscppfile(file) then\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (exclude == file)\nif (excluded) then break end\nend\nif excluded == false then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platform " - "= cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions_cpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedirs(" - "cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p(' LINKCMD = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p(' LINKCMD = $(AR) rcs $(TARGET)')\nelse\n_p(' LINKCMD = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlo" - "cal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJD" - "IR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n", + "SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(cfg, cc)\n_p(' OBJECTS := \\\\')\nfor _, fi" + "le in ipairs(prj.files) do\nif path.iscppfile(file) then\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (exclude == file)\nif (excluded) then break end\nend\nif excluded == false then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platfor" + "m = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions_cpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedir" + "s(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p(' LINKCMD = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p(' LINKCMD = $(AR) rcs $(TARGET)')\nelse\n_p(' LINKCMD = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\n" + "local testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OB" + "JDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n", /* actions/make/make_csharp.lua */ "local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n local name = cfg.buildtarget.basename .. \".\"\n local dir = path.getdirectory(fname)\n if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.project.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Co" diff --git a/3rdparty/mongoose/mongoose.c b/3rdparty/mongoose/mongoose.c index c466c3543df..9c7ca165271 100644 --- a/3rdparty/mongoose/mongoose.c +++ b/3rdparty/mongoose/mongoose.c @@ -48,7 +48,7 @@ #define _INTEGRAL_MAX_BITS 64 // Enable _stati64() on Windows #define _CRT_SECURE_NO_WARNINGS // Disable deprecation warning in VS2005+ #undef WIN32_LEAN_AND_MEAN // Let windows.h always include winsock2.h -#if defined(__Linux__) || defined(_WIN32) +#ifdef __Linux__ #define _XOPEN_SOURCE 600 // For flockfile() on Linux #endif #define __STDC_FORMAT_MACROS // wants this for C++ @@ -377,7 +377,8 @@ void iobuf_remove(struct iobuf *io, size_t n) { static size_t ns_out(struct ns_connection *nc, const void *buf, size_t len) { if (nc->flags & NSF_UDP) { - long n = sendto(nc->sock, (const char*)buf, len, 0, &nc->sa.sa, sizeof(nc->sa.sin)); + long n = sendto(nc->sock, (const char *) buf, len, 0, &nc->sa.sa, + sizeof(nc->sa.sin)); DBG(("%p %d send %ld (%d %s)", nc, nc->sock, n, errno, strerror(errno))); return n < 0 ? 0 : n; } else { @@ -900,6 +901,7 @@ static void ns_read_from_socket(struct ns_connection *conn) { } else { ok = 1; } + conn->flags &= ~(NSF_WANT_READ | NSF_WANT_WRITE); } #endif conn->flags &= ~NSF_CONNECTING; @@ -928,6 +930,7 @@ static void ns_read_from_socket(struct ns_connection *conn) { int ssl_err = ns_ssl_err(conn, res); if (res == 1) { conn->flags |= NSF_SSL_HANDSHAKE_DONE; + conn->flags &= ~(NSF_WANT_READ | NSF_WANT_WRITE); } else if (ssl_err == SSL_ERROR_WANT_READ || ssl_err == SSL_ERROR_WANT_WRITE) { return; // Call us again @@ -965,6 +968,8 @@ static void ns_write_to_socket(struct ns_connection *conn) { } else { conn->flags |= NSF_CLOSE_IMMEDIATELY; } + } else { + conn->flags &= ~(NSF_WANT_READ | NSF_WANT_WRITE); } } else #endif @@ -1273,12 +1278,7 @@ void ns_mgr_free(struct ns_mgr *s) { #define STR(x) STRX(x) #define __func__ __FILE__ ":" STR(__LINE__) #endif -/* MINGW has adopted the MSVC formatting for 64-bit ints as of gcc 4.4 till 4.8*/ -#if (defined(__MINGW32__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4 && __GNUC_MINOR__ < 8))) || defined(_MSC_VER) #define INT64_FMT "I64d" -#else -#define INT64_FMT "lld" -#endif #define flockfile(x) ((void) (x)) #define funlockfile(x) ((void) (x)) typedef struct _stati64 file_stat_t;