Skip to content

Commit

Permalink
IGL: Tidy up platform names
Browse files Browse the repository at this point in the history
Reviewed By: rameshviswanathan

Differential Revision: D66903566

fbshipit-source-id: ddf6e6ac68d048afbc9a34c3bae30fd86ca720ef
  • Loading branch information
Eric Griffith authored and facebook-github-bot committed Dec 10, 2024
1 parent 539ac42 commit 7555936
Show file tree
Hide file tree
Showing 51 changed files with 198 additions and 198 deletions.
4 changes: 2 additions & 2 deletions IGLU/imgui/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static std::string getOpenGLVertexShaderSource(igl::ShaderVersion shaderVersion)
std::string shader;
if (shaderVersion.majorVersion > 1 || shaderVersion.minorVersion > 30 ||
shaderVersion.family == igl::ShaderFamily::GlslEs) {
#if IGL_PLATFORM_MACOS
#if IGL_PLATFORM_MACOSX
shader += "#version 100\n";
#endif
shader += "precision mediump float;";
Expand Down Expand Up @@ -105,7 +105,7 @@ static std::string getOpenGLFragmentShaderSource(igl::ShaderVersion shaderVersio
std::string shader;
if (shaderVersion.majorVersion > 1 || shaderVersion.minorVersion > 30 ||
shaderVersion.family == igl::ShaderFamily::GlslEs) {
#if IGL_PLATFORM_MACOS
#if IGL_PLATFORM_MACOSX
shader += "#version 100\n";
#endif
shader += "precision mediump float;";
Expand Down
2 changes: 1 addition & 1 deletion IGLU/shaderCross/ShaderCross.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ std::string ShaderCross::crossCompileFromVulkanSource(const char* source,
if (device_.getBackendType() == igl::BackendType::Metal) {
spirv_cross::CompilerMSL mslCompiler(std::move(spirvCode));
spirv_cross::CompilerMSL::Options options;
#if IGL_PLATFORM_MACOS
#if IGL_PLATFORM_MACOSX
options.platform = spirv_cross::CompilerMSL::Options::macOS;
#else
options.platform = spirv_cross::CompilerMSL::Options::iOS;
Expand Down
6 changes: 3 additions & 3 deletions samples/desktop/Tiny/Tiny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

// clang-format off
#if USE_OPENGL_BACKEND
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#include <igl/opengl/wgl/Context.h>
#include <igl/opengl/wgl/Device.h>
#include <igl/opengl/wgl/HWDevice.h>
Expand Down Expand Up @@ -195,7 +195,7 @@ static void initIGL() {
// create a device
{
#if USE_OPENGL_BACKEND
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
auto ctx = std::make_unique<igl::opengl::wgl::Context>(GetDC(glfwGetWin32Window(window_)),
glfwGetWGLContext(window_));
device_ = std::make_unique<igl::opengl::wgl::Device>(std::move(ctx));
Expand Down Expand Up @@ -290,7 +290,7 @@ static std::shared_ptr<ITexture> getNativeDrawable() {
Result ret;
std::shared_ptr<ITexture> drawable;
#if USE_OPENGL_BACKEND
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
const auto& platformDevice = device_->getPlatformDevice<opengl::wgl::PlatformDevice>();
IGL_DEBUG_ASSERT(platformDevice != nullptr);
drawable = platformDevice->createTextureFromNativeDrawable(&ret);
Expand Down
8 changes: 4 additions & 4 deletions samples/desktop/Tiny/Tiny_MeshLarge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#include <igl/RenderCommandEncoder.h>
#include <igl/opengl/RenderCommandEncoder.h>
#include <igl/opengl/RenderPipelineState.h>
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#include <igl/opengl/wgl/Context.h>
#include <igl/opengl/wgl/Device.h>
#include <igl/opengl/wgl/HWDevice.h>
Expand Down Expand Up @@ -951,7 +951,7 @@ void initIGL() {
{
const Result result;
#if USE_OPENGL_BACKEND
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
auto ctx = std::make_unique<igl::opengl::wgl::Context>(GetDC(glfwGetWin32Window(window_)),
glfwGetWGLContext(window_));
device_ = std::make_unique<igl::opengl::wgl::Device>(std::move(ctx));
Expand Down Expand Up @@ -1736,7 +1736,7 @@ std::shared_ptr<ITexture> getNativeDrawable() {
Result ret;
std::shared_ptr<ITexture> drawable;
#if USE_OPENGL_BACKEND
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
const auto& platformDevice = device_->getPlatformDevice<opengl::wgl::PlatformDevice>();
IGL_DEBUG_ASSERT(platformDevice != nullptr);
drawable = platformDevice->createTextureFromNativeDrawable(&ret);
Expand All @@ -1760,7 +1760,7 @@ std::shared_ptr<ITexture> getNativeDepthDrawable() {
Result ret;
std::shared_ptr<ITexture> drawable;
#if USE_OPENGL_BACKEND
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
const auto& platformDevice = device_->getPlatformDevice<opengl::wgl::PlatformDevice>();
IGL_DEBUG_ASSERT(platformDevice != nullptr);
drawable = platformDevice->createTextureFromNativeDepth(width_, height_, &ret);
Expand Down
4 changes: 2 additions & 2 deletions shell/openxr/XrPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
#endif // IGL_BACKEND_OPENGL
#endif // IGL_PLATFORM_ANDROID

#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#include <unknwn.h>
#include <windows.h>
#endif // IGL_PLATFORM_WIN
#endif // IGL_PLATFORM_WINDOWS

#include <openxr/openxr.h>
#include <openxr/openxr_platform.h>
8 changes: 4 additions & 4 deletions shell/openxr/mobile/AndroidMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include <shell/openxr/mobile/opengl/XrAppImplGLES.h>
#endif

#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#include "ShellScalingApi.h"
#endif // IGL_PLATFORM_WIN
#endif // IGL_PLATFORM_WINDOWS

XrInstance gInstance_;
XrInstance getXrInstance() {
Expand Down Expand Up @@ -194,9 +194,9 @@ void android_main(struct android_app* app) {
#else
// To run via MetaXR Simulator or Monado.
int main(int argc, const char* argv[]) {
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
#endif // IGL_PLATFORM_WIN
#endif // IGL_PLATFORM_WINDOWS

#if defined(USE_VULKAN_BACKEND)
// Do not present running on MetaXR Simulator. It has its own composition and present.
Expand Down
4 changes: 2 additions & 2 deletions shell/openxr/mobile/XrApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <shell/shared/imageLoader/android/ImageLoaderAndroid.h>
#include <shell/shared/platform/android/PlatformAndroid.h>
#endif
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#include <shell/shared/platform/win/PlatformWin.h>
#endif

Expand Down Expand Up @@ -557,7 +557,7 @@ void XrApp::createShellSession(std::unique_ptr<igl::IDevice> device, AAssetManag
static_cast<igl::shell::FileLoaderAndroid&>(platform_->getFileLoader()).setAssetManager(assetMgr);
#elif IGL_PLATFORM_APPLE
platform_ = std::make_shared<igl::shell::PlatformMac>(std::move(device));
#elif IGL_PLATFORM_WIN
#elif IGL_PLATFORM_WINDOWS
platform_ = std::make_shared<igl::shell::PlatformWin>(std::move(device));
#endif

Expand Down
2 changes: 1 addition & 1 deletion shell/renderSessions/GPUStressSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ std::string GPUStressSession::getCurrentUsageString() const {
return output;
}
void GPUStressSession::setNumLayers(size_t numLayers) {
#if !defined(IGL_PLATFORM_WIN)
#if !defined(IGL_PLATFORM_WINDOWS)
igl::shell::QuadLayerParams params;
params.layerInfo.reserve(numLayers);
for (int i = 0; i < numLayers; i++) {
Expand Down
2 changes: 1 addition & 1 deletion shell/shared/extension/SymbolFactoryLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define IGL_DL_UNIX 1
#elif (defined(IGL_PLATFORM_ANDROID) && IGL_PLATFORM_ANDROID)
#define IGL_DL_UNIX 1
#elif (defined(IGL_PLATFORM_WIN) && IGL_PLATFORM_WIN) && !defined(IGL_PLATFORM_UWP)
#elif (defined(IGL_PLATFORM_WINDOWS) && IGL_PLATFORM_WINDOWS) && !defined(IGL_PLATFORM_UWP)
#define IGL_DL_DLL 1
#endif
#endif // !defined(IGL_DL_UNIX) || !defined(IGL_DL_DLL)
Expand Down
4 changes: 2 additions & 2 deletions shell/shared/fileLoader/win/FileLoaderWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// @fb-only
// @fb-only
// @fb-only
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#include <windows.h>
#endif

Expand Down Expand Up @@ -49,7 +49,7 @@ std::string findSubdir(const char* subdir, const std::string& fileName) {
namespace igl::shell {

FileLoaderWin::FileLoaderWin() {
#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
wchar_t path[MAX_PATH] = {0};
if (IGL_DEBUG_VERIFY(GetModuleFileNameW(NULL, path, MAX_PATH) != 0)) {
basePath_ = std::filesystem::path(path).parent_path().string();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void SaveFrameBufferToPng(const char* absoluteFilename,

const size_t numPixels = frameBuffersize.width * frameBuffersize.height * bytesPerPixel;

#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
if (imageData.desc.format == TextureFormat::BGRA_UNorm8) {
// Swap B and R channels, as image writer expects RGBA.
// Note that this is only defined for the Windows platform, as in practice
Expand Down
4 changes: 2 additions & 2 deletions shell/shared/testShell/TestShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ void TestShellBase::SetUp(ScreenSize screenSize) {
std::shared_ptr<igl::IDevice> iglDevice = createTestDevice();
ASSERT_TRUE(iglDevice != nullptr);
// Create platform shell to run the tests with
#if defined(IGL_PLATFORM_MACOS) && IGL_PLATFORM_MACOS
#if defined(IGL_PLATFORM_MACOSX) && IGL_PLATFORM_MACOSX
platform_ = std::make_shared<igl::shell::PlatformMac>(std::move(iglDevice));
#elif defined(IGL_PLATFORM_IOS) && IGL_PLATFORM_IOS
platform_ = std::make_shared<igl::shell::PlatformIos>(std::move(iglDevice));
#elif defined(IGL_PLATFORM_WIN) && IGL_PLATFORM_WIN
#elif defined(IGL_PLATFORM_WINDOWS) && IGL_PLATFORM_WINDOWS
platform_ = std::make_shared<igl::shell::PlatformWin>(std::move(iglDevice));
#elif defined(IGL_PLATFORM_ANDROID) && IGL_PLATFORM_ANDROID
platform_ = std::make_shared<igl::shell::PlatformAndroid>(std::move(iglDevice));
Expand Down
4 changes: 2 additions & 2 deletions src/igl/Assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void setDebugBreakEnabled(bool enabled) {
#if IGL_PLATFORM_APPLE || IGL_PLATFORM_ANDROID || IGL_PLATFORM_LINUX
#define IGL_DEBUGGER_SIGTRAP 1
#include <csignal>
#elif IGL_PLATFORM_WIN
#elif IGL_PLATFORM_WINDOWS
#include <igl/Log.h>
#include <windows.h>
#endif
Expand All @@ -57,7 +57,7 @@ void _IGLDebugBreak() {
if (igl::isDebugBreakEnabled()) {
#ifdef IGL_DEBUGGER_SIGTRAP
raise(SIGTRAP);
#elif IGL_PLATFORM_WIN
#elif IGL_PLATFORM_WINDOWS
if (!IsDebuggerPresent()) {
IGLLog(IGLLogError, "[IGL] Skipping debug break - debugger not present");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/igl/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct BufferDesc {
type(type),
debugName(std::move(debugName)) {
if (storage == ResourceStorage::Invalid) {
#if IGL_PLATFORM_MACOS
#if IGL_PLATFORM_MACOSX
storage = ResourceStorage::Managed;
#else
storage = ResourceStorage::Shared;
Expand Down
4 changes: 2 additions & 2 deletions src/igl/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

#if IGL_PLATFORM_ANDROID
#include <igl/android/LogDefault.h>
#elif IGL_PLATFORM_WIN
#elif IGL_PLATFORM_WINDOWS
#include <igl/win/LogDefault.h>
#endif

// Returns a "handle" (i.e. ptr to ptr) to func
static IGLLogHandlerFunc* GetHandle() {
#if IGL_PLATFORM_ANDROID
static IGLLogHandlerFunc sHandler = IGLAndroidLogDefaultHandler;
#elif IGL_PLATFORM_WIN
#elif IGL_PLATFORM_WINDOWS
static IGLLogHandlerFunc sHandler = IGLWinLogDefaultHandler;
#else
static IGLLogHandlerFunc sHandler = IGLLogDefaultHandler;
Expand Down
36 changes: 18 additions & 18 deletions src/igl/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
/// The following set of conditionals exist and currently are supported:
///
/// Windows:
/// IGL_PLATFORM_WIN
/// IGL_PLATFORM_WINDOWS
/// Apple:
/// IGL_PLATFORM_APPLE
/// IGL_PLATFORM_IOS
/// IGL_PLATFORM_IOS_SIMULATOR
/// IGL_PLATFORM_MACCATALYST
/// IGL_PLATFORM_MACOS
/// IGL_PLATFORM_MACOSX
/// Android:
/// IGL_PLATFORM_ANDROID
/// Linux:
Expand All @@ -36,18 +36,18 @@
// clang-format off
// Windows
#if defined(_WIN32)
#define IGL_PLATFORM_WIN 1
#define IGL_PLATFORM_WINDOWS 1
#define IGL_PLATFORM_APPLE 0
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#define IGL_PLATFORM_ANDROID 0
#define IGL_PLATFORM_LINUX 0
#define IGL_PLATFORM_EMSCRIPTEN 0
// Apple
#elif defined (__APPLE__)
#define IGL_PLATFORM_WIN 0
#define IGL_PLATFORM_WINDOWS 0
#define IGL_PLATFORM_ANDROID 0
#define IGL_PLATFORM_LINUX 0
#define IGL_PLATFORM_APPLE 1
Expand All @@ -58,33 +58,33 @@
#define IGL_PLATFORM_IOS 1 // iOS Simulator is iOS
#define IGL_PLATFORM_IOS_SIMULATOR 1
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#elif TARGET_OS_MACCATALYST
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 1
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#elif TARGET_OS_IPHONE
#define IGL_PLATFORM_IOS 1
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#elif TARGET_OS_OSX
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 1
#define IGL_PLATFORM_MACOSX 1
#else
#error "Unknown Apple target"
#endif
// Android
#elif defined(__ANDROID__)
#define IGL_PLATFORM_WIN 0
#define IGL_PLATFORM_WINDOWS 0
#define IGL_PLATFORM_APPLE 0
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#define IGL_PLATFORM_ANDROID 1
#define IGL_PLATFORM_LINUX 0
#define IGL_PLATFORM_EMSCRIPTEN 0
Expand All @@ -95,33 +95,33 @@

// Linux
#elif defined(__linux__)
#define IGL_PLATFORM_WIN 0
#define IGL_PLATFORM_WINDOWS 0
#define IGL_PLATFORM_APPLE 0
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#define IGL_PLATFORM_ANDROID 0
#define IGL_PLATFORM_LINUX 1
#define IGL_PLATFORM_EMSCRIPTEN 0
#elif defined(__EMSCRIPTEN__)
#define IGL_PLATFORM_WIN 0
#define IGL_PLATFORM_WINDOWS 0
#define IGL_PLATFORM_APPLE 0
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#define IGL_PLATFORM_ANDROID 0
#define IGL_PLATFORM_LINUX 0
#define IGL_PLATFORM_EMSCRIPTEN 1
// Rest
#else
#define IGL_PLATFORM_WIN 0
#define IGL_PLATFORM_WINDOWS 0
#define IGL_PLATFORM_APPLE 0
#define IGL_PLATFORM_IOS 0
#define IGL_PLATFORM_IOS_SIMULATOR 0
#define IGL_PLATFORM_MACCATALYST 0
#define IGL_PLATFORM_MACOS 0
#define IGL_PLATFORM_MACOSX 0
#define IGL_PLATFORM_ANDROID 0
#define IGL_PLATFORM_LINUX 0
#define IGL_PLATFORM_EMSCRIPTEN 0
Expand Down Expand Up @@ -355,7 +355,7 @@
///--------------------------------------
/// MARK: - Newline

#if IGL_PLATFORM_WIN
#if IGL_PLATFORM_WINDOWS
#define IGL_NEWLINE "\r\n"
#else
#define IGL_NEWLINE "\n"
Expand Down
2 changes: 1 addition & 1 deletion src/igl/NameHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool detectCrc32() {
return hwcaps & HWCAP_CRC32 ? true : false;
}
} // namespace
#elif IGL_PLATFORM_APPLE || IGL_PLATFORM_IOS || IGL_PLATFORM_MACOS
#elif IGL_PLATFORM_APPLE || IGL_PLATFORM_IOS || IGL_PLATFORM_MACOSX
namespace {
bool detectCrc32() {
// All iphones6+ are support it
Expand Down
Loading

0 comments on commit 7555936

Please sign in to comment.