Skip to content

Commit

Permalink
feat: bring back ios-simulator support
Browse files Browse the repository at this point in the history
This reverts commit 8cb7445.
  • Loading branch information
okwasniewski committed Apr 12, 2024
1 parent 56ad576 commit 0192f94
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/09-hdr/hdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class ExampleHDR : public entry::AppI

if (bgfx::isValid(m_rb) )
{
struct Packed { uint8_t bgra[4]; } arr = bx::bit_cast<Packed>(m_lumBgra8);
struct Packed { uint8_t bgra[4]; } arr = bx::bitCast<Packed>(m_lumBgra8);
float exponent = arr.bgra[3] / 255.0f * 255.0f - 128.0f;
float lumAvg = arr.bgra[2] / 255.0f * bx::exp2(exponent);

Expand Down
2 changes: 1 addition & 1 deletion examples/33-pom/pom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint32_t packF4u(float _x, float _y = 0.0f, float _z = 0.0f, float _w = 0.0f)
arr.value[2] = uint8_t(_z * 127.0f + 128.0f);
arr.value[3] = uint8_t(_w * 127.0f + 128.0f);

return bx::bit_cast<uint32_t>(arr);
return bx::bitCast<uint32_t>(arr);
}

static PosTangentBitangentTexcoordVertex s_cubeVertices[24] =
Expand Down
2 changes: 1 addition & 1 deletion examples/common/entry/entry_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#import <UIKit/UIKit.h>
#import <QuartzCore/CAEAGLLayer.h>

#if __IPHONE_8_0 && !TARGET_IPHONE_SIMULATOR // check if sdk/target supports metal
#if __IPHONE_13_0 // From iOS 13 Simulators support metal
# import <Metal/Metal.h>
# import <QuartzCore/CAMetalLayer.h>
# define HAS_METAL_SDK
Expand Down
2 changes: 1 addition & 1 deletion examples/runtime/ios-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.company.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
18 changes: 18 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ projgen: ## Generate project files for all configurations.
$(GENIE) --with-examples --gcc=wasm2js gmake
$(GENIE) --with-combined-examples --gcc=ios-arm gmake
$(GENIE) --with-combined-examples --gcc=ios-arm64 gmake
$(GENIE) --with-combined-examples --gcc=ios-simulator gmake
$(GENIE) --with-combined-examples --gcc=ios-simulator64 gmake
$(GENIE) --with-combined-examples --gcc=rpi gmake

idl: ## Generate code from IDL.
Expand Down Expand Up @@ -215,6 +217,22 @@ ios-arm64-release: .build/projects/gmake-ios-arm64 ## Build - iOS ARM64 Release
$(MAKE) -R -C .build/projects/gmake-ios-arm64 config=release
ios-arm64: ios-arm64-debug ios-arm64-release ## Build - iOS ARM64 Debug and Release

.build/projects/gmake-ios-simulator:
$(GENIE) --gcc=ios-simulator gmake
ios-simulator-debug: .build/projects/gmake-ios-simulator ## Build - iOS Simulator Debug
$(MAKE) -R -C .build/projects/gmake-ios-simulator config=debug
ios-simulator-release: .build/projects/gmake-ios-simulator ## Build - iOS Simulator Release
$(MAKE) -R -C .build/projects/gmake-ios-simulator config=release
ios-simulator: ios-simulator-debug ios-simulator-release ## Build - iOS Simulator Debug and Release

.build/projects/gmake-ios-simulator64:
$(GENIE) --gcc=ios-simulator64 gmake
ios-simulator64-debug: .build/projects/gmake-ios-simulator64 ## Build - iOS Simulator Debug
$(MAKE) -R -C .build/projects/gmake-ios-simulator64 config=debug
ios-simulator64-release: .build/projects/gmake-ios-simulator64 ## Build - iOS Simulator Release
$(MAKE) -R -C .build/projects/gmake-ios-simulator64 config=release
ios-simulator64: ios-simulator64-debug ios-simulator64-release ## Build - iOS Simulator Debug and Release

.build/projects/gmake-rpi:
$(GENIE) --gcc=rpi gmake
rpi-debug: .build/projects/gmake-rpi ## Build - RasberryPi Debug
Expand Down
5 changes: 5 additions & 0 deletions scripts/genie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,11 @@ function exampleProjectDefaults()
"-framework UIKit",
"-weak_framework Metal",
}
xcodecopyresources {
{ "shaders/metal", {
os.matchfiles(path.join(BGFX_DIR, "examples/runtime/shaders/metal/**.bin"))
}}
}

configuration { "xcode*", "ios" }
kind "WindowedApp"
Expand Down
2 changes: 1 addition & 1 deletion scripts/geometryv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ project ("geometryv")
"-framework UIKit",
}

configuration { "xcode4", "ios" }
configuration { "xcode*", "ios" }
kind "WindowedApp"

configuration { "qnx*" }
Expand Down
2 changes: 1 addition & 1 deletion src/shader_dxbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ namespace bgfx
size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size)
, "%s%f"
, 0 == jj ? "(" : ", "
, bx::bit_cast<float>(operand.un.imm32[jj])
, bx::bitCast<float>(operand.un.imm32[jj])
);
}

Expand Down

0 comments on commit 0192f94

Please sign in to comment.