From 59d6f3d8ee0946a019274c4349f61f4a2a7cbb2b Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Sun, 14 Jul 2013 13:14:48 -0700 Subject: [PATCH] iOS WIP. --- makefile | 6 ++++++ premake/bgfx.lua | 2 +- premake/premake4.lua | 3 +++ src/bgfx_p.h | 30 +++++++++++++++--------------- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/makefile b/makefile index 6b4f97cbb..98ee8d3bb 100755 --- a/makefile +++ b/makefile @@ -86,6 +86,12 @@ osx-release64: make -C .build/projects/gmake-osx config=release64 osx: osx-debug32 osx-release32 osx-debug64 osx-release64 +ios-debug: + make -R -C .build/projects/gmake-ios config=debug +ios-release: + make -R -C .build/projects/gmake-ios config=release +ios: ios-debug ios-release + qnx-arm-debug: make -R -C .build/projects/gmake-qnx-arm config=debug qnx-arm-release: diff --git a/premake/bgfx.lua b/premake/bgfx.lua index e495396bd..e00a878cb 100644 --- a/premake/bgfx.lua +++ b/premake/bgfx.lua @@ -30,7 +30,7 @@ project "bgfx" "$(DXSDK_DIR)/include", } - configuration { "osx" } + configuration { "osx or ios" } files { BGFX_DIR .. "src/**.mm", } diff --git a/premake/premake4.lua b/premake/premake4.lua index 7a455b910..4e6e51004 100644 --- a/premake/premake4.lua +++ b/premake/premake4.lua @@ -103,6 +103,9 @@ function exampleProject(_name, _uuid) } configuration { "ios" } + files { + BGFX_DIR .. "examples/common/**.mm", + } linkoptions { "-framework CoreFoundation", "-framework Foundation", diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 1cd737a80..9ee58b112 100755 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -2200,12 +2200,12 @@ namespace bgfx void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) ) + for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) ) { viewMask >>= ntz; - id += ntz; + view += ntz; - setViewRect(id, _x, _y, _width, _height); + setViewRect(view, _x, _y, _width, _height); } } @@ -2220,12 +2220,12 @@ namespace bgfx void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) { - for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) ) + for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) ) { viewMask >>= ntz; - id += ntz; + view += ntz; - setViewClear(id, _flags, _rgba, _depth, _stencil); + setViewClear(view, _flags, _rgba, _depth, _stencil); } } @@ -2237,12 +2237,12 @@ namespace bgfx void setViewSeqMask(uint32_t _viewMask, bool _enabled) { uint16_t mask = _enabled ? 0xffff : 0x0; - for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) ) + for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) ) { viewMask >>= ntz; - id += ntz; + view += ntz; - m_seqMask[id] = mask; + m_seqMask[view] = mask; } } @@ -2253,12 +2253,12 @@ namespace bgfx void setViewRenderTargetMask(uint32_t _viewMask, RenderTargetHandle _handle) { - for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) ) + for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) ) { viewMask >>= ntz; - id += ntz; + view += ntz; - m_rt[id] = _handle; + m_rt[view] = _handle; } } @@ -2294,12 +2294,12 @@ namespace bgfx void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj, uint8_t _other) { - for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) ) + for (uint32_t view = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = uint32_cnttz(viewMask) ) { viewMask >>= ntz; - id += ntz; + view += ntz; - setViewTransform( (uint8_t)id, _view, _proj, _other); + setViewTransform( (uint8_t)view, _view, _proj, _other); } }