From ae60bd0167483bad342bcaae9fa2638ee5df91d9 Mon Sep 17 00:00:00 2001
From: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
Date: Fri, 16 Jul 2021 14:33:39 -0700
Subject: [PATCH 01/28] [installer/2106-font] revert back to default install
bootstrapper font
Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
---
.../Windows/Packaging/BootstrapperTheme.xml.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in b/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in
index 8d8416539e..c670ef3d9a 100644
--- a/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in
+++ b/cmake/Platform/Windows/Packaging/BootstrapperTheme.xml.in
@@ -4,15 +4,15 @@
#(loc.WindowTitle)
- Open Sans
+ Segoe UI
- Open Sans
+ Segoe UI
- Open Sans
+ Segoe UI
- Open Sans
+ Segoe UI
- Open Sans
+ Segoe UI
From 679ecf480197d234cc86fd123c5535a33c25d474 Mon Sep 17 00:00:00 2001
From: lumberyard-employee-dm
<56135373+lumberyard-employee-dm@users.noreply.github.com>
Date: Fri, 16 Jul 2021 17:40:27 -0500
Subject: [PATCH 02/28] External Gem and Projects now appear in Editor
AssetBrowser (#2227)
* External Gem and Projects now appear in Editor AssetBrowser
Optimized logic populating the FolderAssetBrowserEntries in the Editor AssetBrowser.
Added an "[External]" tag to scan folders which reside outside of the Engine Root
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* Fixed conversion of fixed_string to string when normalizing an added AssetBrowser file path.
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* RootAssetBrowserEntry.cpp Linux conditional expression fix
Because an AZ::IO::PathView is convertible to an AZ::IO::FixedMaxPath and vice-versa, the conversion of the second part of the ternary expression absolutePathView needs to explicitly convert to an AZ::IO::FixedMaxPath
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
---
.../Entries/AssetBrowserEntry.cpp | 4 +-
.../AssetBrowser/Entries/AssetBrowserEntry.h | 5 +-
.../Entries/FolderAssetBrowserEntry.cpp | 4 +-
.../Entries/RootAssetBrowserEntry.cpp | 201 ++++++++----------
.../Entries/RootAssetBrowserEntry.h | 12 +-
.../Entries/SourceAssetBrowserEntry.cpp | 4 +-
6 files changed, 105 insertions(+), 125 deletions(-)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.cpp
index 17a20a9d19..7eae7621d2 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.cpp
@@ -206,12 +206,12 @@ namespace AzToolsFramework
const AZStd::string& AssetBrowserEntry::GetRelativePath() const
{
- return m_relativePath;
+ return m_relativePath.Native();
}
const AZStd::string& AssetBrowserEntry::GetFullPath() const
{
- return m_fullPath;
+ return m_fullPath.Native();
}
const AssetBrowserEntry* AssetBrowserEntry::GetChild(int index) const
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h
index e4a7b6b4cb..24f037a623 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h
@@ -9,6 +9,7 @@
#if !defined(Q_MOC_RUN)
#include
#include
+#include
#include
#include
@@ -130,8 +131,8 @@ namespace AzToolsFramework
protected:
AZStd::string m_name;
QString m_displayName;
- AZStd::string m_relativePath;
- AZStd::string m_fullPath;
+ AZ::IO::Path m_relativePath;
+ AZ::IO::Path m_fullPath;
AZStd::vector m_children;
AssetBrowserEntry* m_parentAssetEntry = nullptr;
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/FolderAssetBrowserEntry.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/FolderAssetBrowserEntry.cpp
index 3c5afab0d0..febd406f23 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/FolderAssetBrowserEntry.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/FolderAssetBrowserEntry.cpp
@@ -37,8 +37,8 @@ namespace AzToolsFramework
void FolderAssetBrowserEntry::UpdateChildPaths(AssetBrowserEntry* child) const
{
- child->m_relativePath = m_relativePath + AZ_CORRECT_DATABASE_SEPARATOR + child->m_name;
- child->m_fullPath = m_fullPath + AZ_CORRECT_DATABASE_SEPARATOR + child->m_name;
+ child->m_relativePath = m_relativePath / child->m_name;
+ child->m_fullPath = m_fullPath / child->m_name;
AssetBrowserEntry::UpdateChildPaths(child);
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp
index 090ad0d6ca..0e132d2581 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp
@@ -10,6 +10,7 @@
#include
#include
+#include
#include
#include
@@ -24,8 +25,6 @@ namespace AzToolsFramework
{
namespace AssetBrowser
{
- const char* GEMS_FOLDER_NAME = "Gems";
-
RootAssetBrowserEntry::RootAssetBrowserEntry()
: AssetBrowserEntry()
{
@@ -53,13 +52,7 @@ namespace AzToolsFramework
EntryCache::GetInstance()->Clear();
m_enginePath = enginePath;
-
- // there is no "Gems" scan folder registered in db, create one manually
- auto gemFolder = aznew FolderAssetBrowserEntry();
- gemFolder->m_name = m_enginePath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
- gemFolder->m_displayName = GEMS_FOLDER_NAME;
- gemFolder->m_isGemsFolder = true;
- AddChild(gemFolder);
+ m_fullPath = enginePath;
}
bool RootAssetBrowserEntry::IsInitialUpdate() const
@@ -80,8 +73,17 @@ namespace AzToolsFramework
if (AZ::IO::FileIOBase::GetInstance()->IsDirectory(scanFolderDatabaseEntry.m_scanFolder.c_str()))
{
- const auto scanFolder = CreateFolders(scanFolderDatabaseEntry.m_scanFolder.c_str(), this);
- scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
+ const auto scanFolder = CreateFolders(scanFolderDatabaseEntry.m_scanFolder, this);
+ // Append an "[External]" to the display if the Scan Folder is NOT relative to the Engine Root path
+ if (!AZ::IO::PathView(scanFolderDatabaseEntry.m_scanFolder).IsRelativeTo(m_enginePath))
+ {
+ scanFolder->m_displayName += " [External]";
+ }
+ else
+ {
+ scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
+ }
+
EntryCache::GetInstance()->m_scanFolderIdMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolder;
}
}
@@ -121,38 +123,34 @@ namespace AzToolsFramework
return;
}
- const char* filePath = fileDatabaseEntry.m_fileName.c_str();
+ AZ::IO::FixedMaxPath absoluteFilePath = AZ::IO::FixedMaxPath(AZStd::string_view{ scanFolder->GetFullPath() })
+ / fileDatabaseEntry.m_fileName.c_str();
AssetBrowserEntry* file;
// file can be either folder or actual file
if (fileDatabaseEntry.m_isFolder)
{
- file = CreateFolders(filePath, scanFolder);
+ file = CreateFolders(absoluteFilePath.Native(), scanFolder);
}
else
{
- AZStd::string sourcePath;
- AZStd::string sourceName;
- AZStd::string sourceExtension;
- StringFunc::Path::Split(filePath, nullptr, &sourcePath, &sourceName, &sourceExtension);
// if missing create folders leading to file's location and get immediate parent
// (we don't need to have fileIds for any folders created yet, they will be added later)
- auto parent = CreateFolders(sourcePath.c_str(), scanFolder);
+ auto parent = CreateFolders(absoluteFilePath.ParentPath().Native(), scanFolder);
// for simplicity in AB, files are represented as sources, but they are missing SourceDatabaseEntry-specific information such as SourceUuid
auto source = aznew SourceAssetBrowserEntry();
- source->m_name = (sourceName + sourceExtension).c_str();
+ source->m_name = absoluteFilePath.Filename().Native();
source->m_fileId = fileDatabaseEntry.m_fileID;
source->m_displayName = QString::fromUtf8(source->m_name.c_str());
source->m_scanFolderId = fileDatabaseEntry.m_scanFolderPK;
- source->m_extension = sourceExtension.c_str();
+ source->m_extension = absoluteFilePath.Extension().Native();
parent->AddChild(source);
file = source;
}
EntryCache::GetInstance()->m_fileIdMap[fileDatabaseEntry.m_fileID] = file;
- AZStd::string fullPath = file->m_fullPath;
- AzFramework::StringFunc::Path::Normalize(fullPath);
- EntryCache::GetInstance()->m_absolutePathToFileId[fullPath] = fileDatabaseEntry.m_fileID;
+ AZStd::string filePath = AZ::IO::PathView(file->m_fullPath).LexicallyNormal().String();
+ EntryCache::GetInstance()->m_absolutePathToFileId[filePath] = fileDatabaseEntry.m_fileID;
}
bool RootAssetBrowserEntry::RemoveFile(const AZ::s64& fileId) const
@@ -305,116 +303,95 @@ namespace AzToolsFramework
}
}
- FolderAssetBrowserEntry* RootAssetBrowserEntry::CreateFolder(const char* folderName, AssetBrowserEntry* parent)
+ AssetBrowserEntry* RootAssetBrowserEntry::GetNearestAncestor(AZ::IO::PathView absolutePathView, AssetBrowserEntry* parent,
+ AZStd::unordered_set& visitedSet)
+ {
+ auto IsPathRelativeToEntry = [absolutePathView](AssetBrowserEntry* assetBrowserEntry)
+ {
+ auto& childPath = assetBrowserEntry->m_fullPath;
+ return absolutePathView.IsRelativeTo(AZ::IO::PathView(childPath));
+ };
+
+ if (visitedSet.contains(parent))
+ {
+ return {};
+ }
+
+ visitedSet.insert(parent);
+
+ AssetBrowserEntry* nearestAncestor{};
+ for (AssetBrowserEntry* childBrowserEntry : parent->m_children)
+ {
+ if (IsPathRelativeToEntry(childBrowserEntry))
+ {
+ // Walk the AssetBrowserEntry Tree looking for a nearer ancestor to the absolute path
+ // If one is not found in the recursive call to GetNearestAncestor, then the childBrowserEntry
+ // is the current best candidate
+ AssetBrowserEntry* candidateAncestor = GetNearestAncestor(absolutePathView, childBrowserEntry, visitedSet);
+ candidateAncestor = candidateAncestor != nullptr ? candidateAncestor : childBrowserEntry;
+ AZ::IO::PathView candidatePathView(candidateAncestor->m_fullPath);
+ // If the candidate is relative to the current nearest ancestor, then it is even nearer to the path
+ if (!nearestAncestor || candidatePathView.IsRelativeTo(nearestAncestor->m_fullPath))
+ {
+ nearestAncestor = candidateAncestor;
+ // If the full path compares equal to the AssetBrowserEntry path, then no need to proceed any further
+ if (AZ::IO::PathView(nearestAncestor->m_fullPath) == absolutePathView)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ return nearestAncestor;
+ }
+
+ FolderAssetBrowserEntry* RootAssetBrowserEntry::CreateFolder(AZStd::string_view folderName, AssetBrowserEntry* parent)
{
auto it = AZStd::find_if(parent->m_children.begin(), parent->m_children.end(), [folderName](AssetBrowserEntry* entry)
- {
- if (!azrtti_istypeof(entry))
- {
- return false;
- }
- return AzFramework::StringFunc::Equal(entry->m_name.c_str(), folderName);
- });
+ {
+ if (!azrtti_istypeof(entry))
+ {
+ return false;
+ }
+ return AZ::IO::PathView(entry->m_name) == AZ::IO::PathView(folderName);
+ });
if (it != parent->m_children.end())
{
return azrtti_cast(*it);
}
const auto folder = aznew FolderAssetBrowserEntry();
folder->m_name = folderName;
- folder->m_displayName = folderName;
+ folder->m_displayName = QString::fromUtf8(folderName.data(), aznumeric_caster(folderName.size()));
parent->AddChild(folder);
return folder;
}
- AssetBrowserEntry* RootAssetBrowserEntry::CreateFolders(const char* relativePath, AssetBrowserEntry* parent)
+ AssetBrowserEntry* RootAssetBrowserEntry::CreateFolders(AZStd::string_view absolutePath, AssetBrowserEntry* parent)
{
- auto children(parent->m_children);
- int n = 0;
+ AZ::IO::PathView absolutePathView(absolutePath);
+ // Find the nearest ancestor path to the absolutePath
+ AZStd::unordered_set visitedSet;
- // check if folder with the same name already exists
- // step through every character in relativePath and compare to each child's relative path of suggested parent
- // if a character @n in child's rel path mismatches character at n in relativePath, remove that child from further search
- while (!children.empty() && relativePath[n])
+ if (AssetBrowserEntry* nearestAncestor = GetNearestAncestor(absolutePathView, parent, visitedSet);
+ nearestAncestor != nullptr)
{
- AZStd::vector toRemove;
- for (auto child : children)
- {
- auto& childPath = azrtti_istypeof(parent) ? child->m_fullPath : child->m_relativePath;
-
- // child's path mismatched, remove it from search candidates
- if (childPath.length() == n || childPath[n] != relativePath[n])
- {
- toRemove.push_back(child);
-
- // it is possible that child may be a closer parent, substitute it as new potential parent
- // e.g. child->m_relativePath = 'Gems', relativePath = 'Gems/Assets', old parent = root, new parent = Gems
- if (childPath.length() == n && relativePath[n] == AZ_CORRECT_DATABASE_SEPARATOR)
- {
- parent = child;
- relativePath += n; // advance relative path n characters since the parent has changed
- n = 0; // Once the relative path pointer is advanced, reset n
- }
- }
- }
- for (auto entry : toRemove)
- {
- children.erase(AZStd::remove(children.begin(), children.end(), entry), children.end());
- }
- n++;
+ parent = nearestAncestor;
}
- // filter out the remaining children that don't end with '/' or '\0'
- // for example if folderName = "foo", while children may still remain with names like "foo123",
- // which is not the same folder
- AZStd::vector toRemove;
- for (auto child : children)
+ // If the nearest ancestor is the absolutePath, then it is already crated
+ if (absolutePathView == AZ::IO::PathView(parent->GetFullPath()))
{
- auto& childPath = azrtti_istypeof(parent) ? child->m_fullPath : child->m_relativePath;
- // check if there are non-null characters remaining @n
- if (childPath.length() > n)
- {
- toRemove.push_back(child);
- }
- }
- for (auto entry : toRemove)
- {
- children.erase(AZStd::remove(children.begin(), children.end(), entry), children.end());
+ return parent;
}
- // at least one child remains, this means the folder with this name already exists, return it
- if (!children.empty())
+ // create all missing folders
+ auto proximateToPath = absolutePathView.IsRelativeTo(parent->m_fullPath)
+ ? absolutePathView.LexicallyProximate(parent->m_fullPath)
+ : AZ::IO::FixedMaxPath(absolutePathView);
+ for (AZ::IO::FixedMaxPath scanFolderSegment : proximateToPath)
{
- parent = children.front();
- }
- // if it's a scanfolder, then do not create folders leading to it
- // e.g. instead of 'C:\dev\SampleProject' just create 'SampleProject'
- else if (parent->GetEntryType() == AssetEntryType::Root)
- {
- AZStd::string folderName;
- AzFramework::StringFunc::Path::Split(relativePath, nullptr, nullptr, &folderName);
- parent = CreateFolder(folderName.c_str(), parent);
- parent->m_fullPath = relativePath;
- }
- // otherwise create all missing folders
- else
- {
- n = 0;
- AZStd::string folderName(strlen(relativePath) + 1, '\0');
- // iterate through relativePath until the first '/'
- while (relativePath[n] && relativePath[n] != AZ_CORRECT_DATABASE_SEPARATOR)
- {
- folderName[n] = relativePath[n];
- n++;
- }
- if (n > 0)
- {
- parent = CreateFolder(folderName.c_str(), parent);
- }
- // n+1 also skips the '/' character
- if (relativePath[n] && relativePath[n + 1])
- {
- parent = CreateFolders(relativePath + n + 1, parent);
- }
+ parent = CreateFolder(scanFolderSegment.c_str(), parent);
}
return parent;
}
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.h
index 883f9dec01..62fbc7a39d 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.h
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.h
@@ -8,6 +8,7 @@
#include
#include
+#include
#include
#include
@@ -77,12 +78,15 @@ namespace AzToolsFramework
private:
AZ_DISABLE_COPY_MOVE(RootAssetBrowserEntry);
- AZStd::string m_enginePath;
+ AZ::IO::Path m_enginePath;
//! Create folder entry child
- FolderAssetBrowserEntry* CreateFolder(const char* folderName, AssetBrowserEntry* parent);
- //! Recursively create folder structure leading to relative path from parent
- AssetBrowserEntry* CreateFolders(const char* relativePath, AssetBrowserEntry* parent);
+ FolderAssetBrowserEntry* CreateFolder(AZStd::string_view folderName, AssetBrowserEntry* parent);
+ //! Recursively create folder structure leading to path from parent
+ AssetBrowserEntry* CreateFolders(AZStd::string_view absolutePath, AssetBrowserEntry* parent);
+ // Retrieves the nearest ancestor AssetBrowserEntry from the absolutePath
+ static AssetBrowserEntry* GetNearestAncestor(AZ::IO::PathView absolutePath, AssetBrowserEntry* parent,
+ AZStd::unordered_set& visitedSet);
bool m_isInitialUpdate = false;
};
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/SourceAssetBrowserEntry.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/SourceAssetBrowserEntry.cpp
index e45c234c92..1eea909f7c 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/SourceAssetBrowserEntry.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/SourceAssetBrowserEntry.cpp
@@ -26,9 +26,7 @@ namespace AzToolsFramework
if (EntryCache* cache = EntryCache::GetInstance())
{
cache->m_fileIdMap.erase(m_fileId);
- AZStd::string fullPath = m_fullPath;
- AzFramework::StringFunc::Path::Normalize(fullPath);
- cache->m_absolutePathToFileId.erase(fullPath);
+ cache->m_absolutePathToFileId.erase(m_fullPath.LexicallyNormal().Native());
if (m_sourceId != -1)
{
From 173126f5a5f1b3a1efc65e5a902c48d63b2a5ad9 Mon Sep 17 00:00:00 2001
From: Brian Herrera
Date: Mon, 19 Jul 2021 16:09:47 -0700
Subject: [PATCH 03/28] Add script for license scanner (#2267)
* Add script for license scanner
This script will scan the source tree for license files and generate a file with the contents of all the licenses.
Signed-off-by: brianherrera
---
scripts/license_scanner/license_scanner.py | 129 ++++++++++++++++++++
scripts/license_scanner/scanner_config.json | 12 ++
2 files changed, 141 insertions(+)
create mode 100644 scripts/license_scanner/license_scanner.py
create mode 100644 scripts/license_scanner/scanner_config.json
diff --git a/scripts/license_scanner/license_scanner.py b/scripts/license_scanner/license_scanner.py
new file mode 100644
index 0000000000..c0e3c1f1ba
--- /dev/null
+++ b/scripts/license_scanner/license_scanner.py
@@ -0,0 +1,129 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+import argparse
+import fnmatch
+import json
+import os
+import pathlib
+import re
+import sys
+
+
+class LicenseScanner:
+ """Class to contain license scanner.
+
+ Scans source tree for license files using provided filename patterns and generates a file
+ with the contents of all the licenses.
+
+ :param config_file: Config file with license patterns and scanner settings
+ """
+
+ DEFAULT_CONFIG_FILE = 'scanner_config.json'
+
+ def __init__(self, config_file=None):
+ self.config_file = config_file
+ self.config_data = self._load_config()
+ self.license_regex = self._load_license_regex()
+
+ def _load_config(self):
+ """Load config from the provided file. Sets default file if one is not provided."""
+ if self.config_file is None:
+ script_directory = os.path.dirname(os.path.abspath(__file__)) # Default file expected in same dir as script
+ self.config_file = os.path.join(script_directory, self.DEFAULT_CONFIG_FILE)
+
+ try:
+ with open(self.config_file) as f:
+ return json.load(f)
+ except FileNotFoundError:
+ print('Config file cannot be found')
+ raise
+
+ def _load_license_regex(self):
+ """Returns regex object with case-insensitive matching from the list of filename patterns."""
+ regex_patterns = []
+ for pattern in self.config_data['license_patterns']:
+ regex_patterns.append(fnmatch.translate(pattern))
+ return re.compile('|'.join(regex_patterns), re.IGNORECASE)
+
+ def scan(self, path=os.curdir):
+ """Scan directory tree for filenames matching license_regex.
+
+ :param path: Path of the directory to run scanner
+ :return: Package paths and their corresponding license file contents
+ :rtype: dict
+ """
+ licenses = 0
+ license_files = {}
+
+ for dirpath, dirnames, filenames in os.walk(path):
+ for file in filenames:
+ if self.license_regex.match(file):
+ license_file_content = self._get_license_file_contents(os.path.join(dirpath, file))
+ rel_dirpath = os.path.relpath(dirpath, path) # Limit path inside scanned directory
+ license_files[rel_dirpath] = license_file_content
+ licenses += 1
+ print(f'License file: {os.path.join(dirpath, file)}')
+
+ # Remove directories that should not be scanned
+ for dir in self.config_data['excluded_directories']:
+ if dir in dirnames:
+ dirnames.remove(dir)
+ print(f'{licenses} license files found.')
+ return license_files
+
+ def _get_license_file_contents(self, filepath):
+ try:
+ with open(filepath, encoding='utf8') as f:
+ return f.read()
+ except UnicodeDecodeError:
+ print(f'Unable to read license file: {filepath}')
+ pass
+
+ def create_license_file(self, licenses, filepath='NOTICES.txt'):
+ """Creates file with all the provided license file contents.
+
+ :param licenses: Dict with package paths and their corresponding license file contents
+ :param filepath: Path to write the file
+ """
+ package_separator = '------------------------------------'
+ with open(filepath, 'w', encoding='utf8') as f:
+ for directory, license in licenses.items():
+ license_output = '\n\n'.join([
+ f'{package_separator}',
+ f'Package path: {directory}',
+ 'License:',
+ f'{license}\n'
+ ])
+ f.write(license_output)
+ return None
+
+
+def parse_args():
+ parser = argparse.ArgumentParser(
+ description='Script to run LicenseScanner and generate license file')
+ parser.add_argument('--config-file', '-c', type=pathlib.Path, help='Config file for LicenseScanner')
+ parser.add_argument('--license-file-path', '-l', type=pathlib.Path, help='Create license file in the provided path')
+ parser.add_argument('--scan-path', '-s', default=os.curdir, type=pathlib.Path, help='Path to scan')
+ return parser.parse_args()
+
+
+def main():
+ try:
+ args = parse_args()
+ ls = LicenseScanner(args.config_file)
+ licenses = ls.scan(args.scan_path)
+
+ if args.license_file_path:
+ ls.create_license_file(licenses, args.license_file_path)
+ except FileNotFoundError as e:
+ print(f'Type: {type(e).__name__}, Error: {e}')
+ return 1
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/scripts/license_scanner/scanner_config.json b/scripts/license_scanner/scanner_config.json
new file mode 100644
index 0000000000..b5863a7d31
--- /dev/null
+++ b/scripts/license_scanner/scanner_config.json
@@ -0,0 +1,12 @@
+{
+ "excluded_directories": [
+ ".git",
+ ".venv",
+ "build",
+ "license_scanner"
+ ],
+ "license_patterns": [
+ "LICENSE*",
+ "COPYING*"
+ ]
+}
From afb57c9cf679592a209dbccdd5f38126e03d6b59 Mon Sep 17 00:00:00 2001
From: Scott Romero <24445312+AMZN-ScottR@users.noreply.github.com>
Date: Mon, 19 Jul 2021 18:17:55 -0700
Subject: [PATCH 04/28] [stabliziation/2106] update 3rd party license file name
to be pulled into the installer package (#2281)
License file name was changed in #2267
Signed-off-by: AMZN-ScottR 24445312+AMZN-ScottR@users.noreply.github.com
---
cmake/Packaging.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake
index a07e1ec1d3..2240ff472c 100644
--- a/cmake/Packaging.cmake
+++ b/cmake/Packaging.cmake
@@ -128,7 +128,7 @@ install(FILES ${_cmake_package_dest}
# the version string and git tags are intended to be synchronized so it should be safe to use that instead
# of directly calling into git which could get messy in certain scenarios
if(${CPACK_PACKAGE_VERSION} VERSION_GREATER "0.0.0.0")
- set(_3rd_party_license_filename SPDX-Licenses.txt)
+ set(_3rd_party_license_filename NOTICES.txt)
set(_3rd_party_license_url "https://raw.githubusercontent.com/o3de/3p-package-source/${CPACK_PACKAGE_VERSION}/${_3rd_party_license_filename}")
set(_3rd_party_license_dest ${CPACK_BINARY_DIR}/${_3rd_party_license_filename})
From abce54b3cd0a574fff1a8612be838779ab597a73 Mon Sep 17 00:00:00 2001
From: Axel Nana
Date: Tue, 20 Jul 2021 01:05:09 +0100
Subject: [PATCH 05/28] Add missing `*.hxx` pattern
Signed-off-by: Axel Nana
---
cmake/Platform/Common/Install_common.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake
index 5b476667e2..0a84d3ceb2 100644
--- a/cmake/Platform/Common/Install_common.cmake
+++ b/cmake/Platform/Common/Install_common.cmake
@@ -64,6 +64,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
PATTERN *.h
PATTERN *.hpp
PATTERN *.inl
+ PATTERN *.hxx
)
endif()
endforeach()
From b58286d9b1022c3e3051c3225b7000935066fd4c Mon Sep 17 00:00:00 2001
From: lumberyard-employee-dm
<56135373+lumberyard-employee-dm@users.noreply.github.com>
Date: Tue, 20 Jul 2021 20:40:04 -0500
Subject: [PATCH 06/28] Fixed RootAssetBrowserEntry setting of child
AssetBrowserEntries
The issue is due to RootAssetBrowserEntry::UpdateChildPaths not taking
the RootAssetBrowserEntry fullpath into account when appending the child
path entry
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
---
.../AssetBrowser/Entries/RootAssetBrowserEntry.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp
index 0e132d2581..eec9970ca3 100644
--- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp
+++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.cpp
@@ -399,7 +399,7 @@ namespace AzToolsFramework
void RootAssetBrowserEntry::UpdateChildPaths(AssetBrowserEntry* child) const
{
child->m_relativePath = child->m_name;
- child->m_fullPath = child->m_name;
+ child->m_fullPath = m_fullPath / child->m_name;
AssetBrowserEntry::UpdateChildPaths(child);
}
From 3050a4db479fb2dacf59942f7b0b42d7d82fcdcd Mon Sep 17 00:00:00 2001
From: jckand-amzn
Date: Wed, 21 Jul 2021 10:18:18 -0500
Subject: [PATCH 07/28] Removing obsolete Vegetation Debugger test
Signed-off-by: jckand-amzn
---
.../EditorScripts/Debugger_DebugCVarsWorks.py | 55 ------------------
.../largeworlds/dyn_veg/test_Debugger.py | 56 -------------------
2 files changed, 111 deletions(-)
delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/Debugger_DebugCVarsWorks.py
delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_Debugger.py
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/Debugger_DebugCVarsWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/Debugger_DebugCVarsWorks.py
deleted file mode 100755
index 40fd67d957..0000000000
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/Debugger_DebugCVarsWorks.py
+++ /dev/null
@@ -1,55 +0,0 @@
-"""
-Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-
-SPDX-License-Identifier: Apache-2.0 OR MIT
-"""
-
-import os
-import sys
-
-import azlmbr.legacy.general as general
-import azlmbr.paths
-
-sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "PythonTests"))
-import editor_python_test_tools.hydra_editor_utils as hydra
-from editor_python_test_tools.editor_test_helper import EditorTestHelper
-
-
-class TestDebuggerDebugCVarsWorks(EditorTestHelper):
- def __init__(self):
- EditorTestHelper.__init__(self, log_prefix="Debugger_DebugCVarsWorks", args=["level"])
-
- def run_test(self):
- """
- Summary:
- C2789148 Vegetation Debug CVars are enabled when the Debugger component is present
-
- Expected Result:
- The following commands are available in the Editor only when the Vegetation Debugger Level component is present:
- veg_debugDumpReport (Command)
- veg_debugRefreshAllAreas (Command)
-
- :return: None
- """
-
- # Create empty level
- self.test_success = self.create_level(
- self.args["level"],
- heightmap_resolution=1024,
- heightmap_meters_per_pixel=1,
- terrain_texture_resolution=4096,
- use_terrain=False,
- )
-
- # Initially run the command in console without Debugger component
- general.run_console("veg_debugDumpReport")
-
- # Add the Vegetation Debugger component to the Level Inspector
- hydra.add_level_component("Vegetation Debugger")
-
- # Run a command again after adding the Vegetation debugger
- general.run_console("veg_debugRefreshAllAreas")
-
-
-test = TestDebuggerDebugCVarsWorks()
-test.run()
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_Debugger.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_Debugger.py
deleted file mode 100755
index ed979136e0..0000000000
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/test_Debugger.py
+++ /dev/null
@@ -1,56 +0,0 @@
-"""
-Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
-
-SPDX-License-Identifier: Apache-2.0 OR MIT
-"""
-
-import os
-import pytest
-import logging
-
-# Bail on the test if ly_test_tools doesn't exist.
-pytest.importorskip("ly_test_tools")
-import ly_test_tools.environment.file_system as file_system
-import editor_python_test_tools.hydra_test_utils as hydra
-
-logger = logging.getLogger(__name__)
-test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts")
-
-
-@pytest.mark.parametrize("project", ["AutomatedTesting"])
-@pytest.mark.parametrize("level", ["tmp_level"])
-@pytest.mark.usefixtures("automatic_process_killer")
-@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
-class TestDebugger(object):
- @pytest.fixture(autouse=True)
- def setup_teardown(self, request, workspace, project, level):
- # Cleanup our temp level
- file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
-
- def teardown():
- # Cleanup our temp level
- file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
-
- request.addfinalizer(teardown)
-
- @pytest.mark.test_case_id("C2789148")
- @pytest.mark.SUITE_periodic
- @pytest.mark.dynveg_misc
- def test_Debugger_DebugCVarsWork(self, request, editor, level, workspace, launcher_platform):
- cfg_args = [level]
-
- expected_lines = [
- "Debugger_DebugCVarsWorks: test started",
- "[Warning] Unknown command: veg_debugDumpReport",
- "[CONSOLE] Executing console command 'veg_debugRefreshAllAreas'",
- "Debugger_DebugCVarsWorks: result=SUCCESS",
- ]
-
- hydra.launch_and_validate_results(
- request,
- test_directory,
- editor,
- "Debugger_DebugCVarsWorks.py",
- expected_lines=expected_lines,
- cfg_args=cfg_args
- )
From 7ebdde0be01477ba036bad7f5a1e36ae50e2d879 Mon Sep 17 00:00:00 2001
From: jckand-amzn
Date: Wed, 21 Jul 2021 10:25:48 -0500
Subject: [PATCH 08/28] Adding xfail mark to
test_LandscapeCanvas_GraphClosed_OnEntityDelete
Signed-off-by: jckand-amzn
---
.../landscape_canvas/test_GeneralGraphFunctionality.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py
index bbca71461c..e2aa222c3f 100755
--- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py
+++ b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py
@@ -104,6 +104,7 @@ class TestGeneralGraphFunctionality(object):
@pytest.mark.test_case_id("C17488412")
@pytest.mark.SUITE_periodic
+ @pytest.mark.xfail(reason="https://github.com/o3de/o3de/issues/2201")
def test_LandscapeCanvas_GraphClosed_OnEntityDelete(self, request, editor, level, launcher_platform):
cfg_args = [level]
From fc1ccb9e8574a1d997bbc791fb46a6a1325ee3a2 Mon Sep 17 00:00:00 2001
From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
Date: Wed, 21 Jul 2021 17:17:09 -0700
Subject: [PATCH 09/28] Issues/2126 PhysX Gem can't be used as build dependency
in engine SDK Part (#2337)
* Applying GENEX_EVAL to 2 cases where the genex can produce another genex
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
* Missing case when the folder is an external one to the engine/project (e.g. external gems)
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
---
Code/LauncherUnified/launcher_generator.cmake | 4 ++--
cmake/LYWrappers.cmake | 15 ++++++++++-----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/Code/LauncherUnified/launcher_generator.cmake b/Code/LauncherUnified/launcher_generator.cmake
index 628b5fffac..28fddad1eb 100644
--- a/Code/LauncherUnified/launcher_generator.cmake
+++ b/Code/LauncherUnified/launcher_generator.cmake
@@ -40,9 +40,9 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
add_custom_target(${project_name}.Assets
COMMENT "Processing ${project_name} assets..."
COMMAND "${CMAKE_COMMAND}"
- -DLY_LOCK_FILE=$/project_assets.lock
+ -DLY_LOCK_FILE=$>/project_assets.lock
-P ${LY_ROOT_FOLDER}/cmake/CommandExecution.cmake
- EXEC_COMMAND $
+ EXEC_COMMAND $>
--zeroAnalysisMode
--project-path=${project_real_path}
--platforms=${LY_ASSET_DEPLOY_ASSET_TYPE}
diff --git a/cmake/LYWrappers.cmake b/cmake/LYWrappers.cmake
index 40bf6ef541..cfe6df5c81 100644
--- a/cmake/LYWrappers.cmake
+++ b/cmake/LYWrappers.cmake
@@ -391,10 +391,10 @@ function(ly_delayed_target_link_libraries)
endif()
if(item_type STREQUAL MODULE_LIBRARY)
- target_include_directories(${target} ${visibility} $)
- target_link_libraries(${target} ${visibility} $)
- target_compile_definitions(${target} ${visibility} $)
- target_compile_options(${target} ${visibility} $)
+ target_include_directories(${target} ${visibility} $>)
+ target_link_libraries(${target} ${visibility} $>)
+ target_compile_definitions(${target} ${visibility} $>)
+ target_compile_options(${target} ${visibility} $>)
else()
ly_parse_third_party_dependencies(${item})
target_link_libraries(${target} ${visibility} ${item})
@@ -659,7 +659,12 @@ function(ly_get_vs_folder_directory absolute_target_source_dir output_source_dir
if(is_target_prefix_of_engine_root)
cmake_path(RELATIVE_PATH absolute_target_source_dir BASE_DIRECTORY ${LY_ROOT_FOLDER} OUTPUT_VARIABLE relative_target_source_dir)
else()
- cmake_path(GET absolute_target_source_dir RELATIVE_PART relative_target_source_dir)
+ cmake_path(IS_PREFIX CMAKE_SOURCE_DIR ${absolute_target_source_dir} is_target_prefix_of_source_dir)
+ if(is_target_prefix_of_source_dir)
+ cmake_path(RELATIVE_PATH absolute_target_source_dir BASE_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE relative_target_source_dir)
+ else()
+ cmake_path(GET absolute_target_source_dir RELATIVE_PART relative_target_source_dir)
+ endif()
endif()
set(${output_source_dir} ${relative_target_source_dir} PARENT_SCOPE)
From 9358428bebd7d3b0166af8cf447d58d7caf37f72 Mon Sep 17 00:00:00 2001
From: dmcdiar
Date: Sun, 25 Jul 2021 22:39:22 -0700
Subject: [PATCH 10/28] Added object release queue notification to the RHI
Device and ObjectCollector.
Signed-off-by: dmcdiar
---
Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h | 4 ++
.../Code/Include/Atom/RHI/ObjectCollector.h | 60 +++++++++++++++++++
Gems/Atom/RHI/Code/Tests/Device.h | 2 +
Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp | 5 ++
Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h | 1 +
.../Atom/RHI/Metal/Code/Source/RHI/Device.cpp | 7 ++-
Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h | 3 +-
Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp | 5 ++
Gems/Atom/RHI/Null/Code/Source/RHI/Device.h | 1 +
.../RHI/Vulkan/Code/Source/RHI/Device.cpp | 5 ++
Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h | 1 +
Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h | 1 +
12 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h
index 3f79392403..4232658980 100644
--- a/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h
+++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h
@@ -8,6 +8,7 @@
#pragma once
+#include
#include
#include
#include
@@ -140,6 +141,9 @@ namespace AZ
//! Get the memory requirements for allocating a buffer resource.
virtual ResourceMemoryRequirements GetResourceMemoryRequirements(const BufferDescriptor& descriptor) = 0;
+ //! Notifies after all objects currently in the platform release queue are released
+ virtual void ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction) = 0;
+
protected:
DeviceFeatures m_features;
DeviceLimits m_limits;
diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h
index cb66225286..d79a86afea 100644
--- a/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h
+++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h
@@ -34,6 +34,8 @@ namespace AZ
using MutexType = NullMutex;
};
+ using ObjectCollectorNotifyFunction = AZStd::function;
+
/**
* Deferred-releases reference-counted objects at a specific latency. Example: Use to batch-release
* objects that exist on the GPU timeline at the end of the frame after syncing the oldest GPU frame.
@@ -85,6 +87,9 @@ namespace AZ
/// Must not be called at collection time.
size_t GetObjectCount() const;
+ /// Notifies after the current set of pending objects is released.
+ void Notify(ObjectCollectorNotifyFunction notifyFunction);
+
private:
void QueueForCollectInternal(ObjectPtrType object);
@@ -92,6 +97,7 @@ namespace AZ
{
AZStd::vector m_objects;
uint64_t m_collectIteration;
+ AZStd::vector m_notifies;
};
inline bool IsGarbageReady(size_t collectIteration)
@@ -106,6 +112,7 @@ namespace AZ
mutable typename Traits::MutexType m_mutex;
AZStd::vector m_pendingObjects;
AZStd::vector m_pendingGarbage;
+ AZStd::vector m_pendingNotifies;
};
template
@@ -174,6 +181,45 @@ namespace AZ
}
m_mutex.unlock();
+ if (m_pendingNotifies.size())
+ {
+ if (m_pendingGarbage.size())
+ {
+ // find the newest garbage entry and add any pending notifies
+ Garbage& latestGarbage = m_pendingGarbage.front();
+ size_t latestGarbageAge = m_currentIteration - latestGarbage.m_collectIteration;
+ size_t i = 1;
+ while (i < m_pendingGarbage.size())
+ {
+ size_t age = m_currentIteration - m_pendingGarbage[i].m_collectIteration;
+ if (age < latestGarbageAge)
+ {
+ latestGarbage = m_pendingGarbage[i];
+ latestGarbageAge = age;
+ }
+ }
+
+ latestGarbage.m_notifies.insert(latestGarbage.m_notifies.end(), m_pendingNotifies.begin(), m_pendingNotifies.end());
+
+ m_mutex.lock();
+ m_pendingNotifies.clear();
+ m_mutex.unlock();
+
+ }
+ else
+ {
+ // garbage queue is empty, notify now
+ m_mutex.lock();
+ for (auto& notifyFunction : m_pendingNotifies)
+ {
+ notifyFunction();
+ }
+
+ m_pendingNotifies.clear();
+ m_mutex.unlock();
+ }
+ }
+
size_t objectCount = 0;
size_t i = 0;
while (i < m_pendingGarbage.size())
@@ -189,6 +235,12 @@ namespace AZ
}
}
objectCount += garbage.m_objects.size();
+
+ for (auto& notifyFunction : garbage.m_notifies)
+ {
+ notifyFunction();
+ }
+
garbage = AZStd::move(m_pendingGarbage.back());
m_pendingGarbage.pop_back();
}
@@ -215,5 +267,13 @@ namespace AZ
return objectCount;
}
+
+ template
+ void ObjectCollector::Notify(ObjectCollectorNotifyFunction notifyFunction)
+ {
+ m_mutex.lock();
+ m_pendingNotifies.push_back(notifyFunction);
+ m_mutex.unlock();
+ }
}
}
diff --git a/Gems/Atom/RHI/Code/Tests/Device.h b/Gems/Atom/RHI/Code/Tests/Device.h
index 3a7c513c8b..e11bd75983 100644
--- a/Gems/Atom/RHI/Code/Tests/Device.h
+++ b/Gems/Atom/RHI/Code/Tests/Device.h
@@ -60,6 +60,8 @@ namespace UnitTest
AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::ImageDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; };
AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::BufferDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; };
+
+ void ObjectCollectionNotify(AZ::RHI::ObjectCollectorNotifyFunction notifyFunction) override {}
};
AZ::RHI::Ptr MakeTestDevice();
diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp
index 88c9098952..9d23dfa43d 100644
--- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp
+++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp
@@ -292,6 +292,11 @@ namespace AZ
return memoryRequirements;
}
+ void Device::ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction)
+ {
+ m_releaseQueue.Notify(notifyFunction);
+ }
+
//AZStd::vector Device::GetValidSwapChainImageFormats(const RHI::WindowHandle& windowHandle) const
//{
// AZStd::vector formatsList;
diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h
index 149508307a..9119545342 100644
--- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h
+++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h
@@ -162,6 +162,7 @@ namespace AZ
void PreShutdown() override;
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::ImageDescriptor & descriptor) override;
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::BufferDescriptor & descriptor) override;
+ void ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction) override;
//////////////////////////////////////////////////////////////////////////
RHI::ResultCode InitSubPlatform(RHI::PhysicalDevice& physicalDevice);
diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp
index f0771d7c45..dbd2204e93 100644
--- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp
+++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp
@@ -315,7 +315,12 @@ namespace AZ
memoryRequirements.m_sizeInBytes = bufferSizeAndAlign.size;
return memoryRequirements;
}
-
+
+ void Device::ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction)
+ {
+ m_releaseQueue.Notify(notifyFunction);
+ }
+
void Device::InitFeatures()
{
diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h
index d8c3092c59..9cdeee7eae 100644
--- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h
+++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h
@@ -151,7 +151,8 @@ namespace AZ
NullDescriptorManager& GetNullDescriptorManager();
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::ImageDescriptor & descriptor) override;
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::BufferDescriptor & descriptor) override;
-
+ void ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction) override;
+
private:
Device() = default;
diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp
index 7b94efb69f..08a2c4f411 100644
--- a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp
+++ b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp
@@ -20,5 +20,10 @@ namespace AZ
{
formatsCapabilities.fill(static_cast(~0));
}
+
+ void Device::ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction)
+ {
+ notifyFunction();
+ }
}
}
diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h
index 3aa045212b..cd44135e62 100644
--- a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h
+++ b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h
@@ -42,6 +42,7 @@ namespace AZ
void PreShutdown() override {}
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const RHI::ImageDescriptor& descriptor) override { return RHI::ResourceMemoryRequirements();}
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const RHI::BufferDescriptor& descriptor) override { return RHI::ResourceMemoryRequirements();}
+ void ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction) override;
//////////////////////////////////////////////////////////////////////////
};
}
diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp
index 6d3080dce8..05ff8bb2a6 100644
--- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp
+++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp
@@ -652,6 +652,11 @@ namespace AZ
return RHI::ResourceMemoryRequirements{ vkRequirements.alignment, vkRequirements.size };
}
+ void Device::ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction)
+ {
+ m_releaseQueue.Notify(notifyFunction);
+ }
+
void Device::InitFeaturesAndLimits(const PhysicalDevice& physicalDevice)
{
m_features.m_tessellationShader = (m_enabledDeviceFeatures.tessellationShader == VK_TRUE);
diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h
index d5f055f4cd..28e56d1fa9 100644
--- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h
+++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h
@@ -134,6 +134,7 @@ namespace AZ
void PreShutdown() override;
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::ImageDescriptor& descriptor) override;
RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::BufferDescriptor& descriptor) override;
+ void ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction) override;
//////////////////////////////////////////////////////////////////////////
void InitFeaturesAndLimits(const PhysicalDevice& physicalDevice);
diff --git a/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h b/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h
index 1de06802b1..be362c60d6 100644
--- a/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h
+++ b/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h
@@ -70,6 +70,7 @@ namespace UnitTest
void PreShutdown() override {}
AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::ImageDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; };
AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::BufferDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; };
+ void ObjectCollectionNotify(AZ::RHI::ObjectCollectorNotifyFunction notifyFunction) override {}
};
class ImageView
From 26c9853ff9916b7216a5e01eef6b9f7be8bb4df1 Mon Sep 17 00:00:00 2001
From: moraaar
Date: Tue, 27 Jul 2021 09:11:28 +0100
Subject: [PATCH 11/28] Fixed cloth tangent generation (#2440)
- The output vectors were not properly filled with zeros when they already had the expected size.
- The tolerance was too large and was causing patches while computing tangents and bitangents.
- The handedness was inverted to what is expected in the shader (which always inverts tangent's w).
Signed-off-by: moraaar
---
.../ClothComponentMesh/ClothComponentMesh.cpp | 2 +-
.../Code/Source/System/TangentSpaceHelper.cpp | 20 ++++++++++++-------
.../ClothConstraintsTest.cpp | 12 ++++++++---
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp
index b791e8a543..7e0ac2f230 100644
--- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp
+++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp
@@ -577,7 +577,7 @@ namespace NvCloth
const AZ::Vector3& renderTangent = renderTangents[renderVertexIndex];
destTangentsBuffer[index].Set(
renderTangent,
- 1.0f);
+ -1.0f); // Shader function ConstructTBN inverts w to change bitangent sign, but the bitangents passed are already corrected, so passing -1.0 to counteract.
}
if (destBitangentsBuffer)
diff --git a/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp b/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp
index b43ad1923b..e388643c00 100644
--- a/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp
+++ b/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp
@@ -11,7 +11,7 @@ namespace NvCloth
{
namespace
{
- const float Tolerance = 0.0001f;
+ const float Tolerance = 1e-7f;
}
bool TangentSpaceHelper::CalculateNormals(
@@ -33,7 +33,8 @@ namespace NvCloth
const size_t vertexCount = vertices.size();
// Reset results
- outNormals.resize(vertexCount, AZ::Vector3::CreateZero());
+ outNormals.resize(vertexCount);
+ AZStd::fill(outNormals.begin(), outNormals.end(), AZ::Vector3::CreateZero());
// calculate the normals per triangle
for (size_t i = 0; i < triangleCount; ++i)
@@ -114,8 +115,10 @@ namespace NvCloth
const size_t vertexCount = vertices.size();
// Reset results
- outTangents.resize(vertexCount, AZ::Vector3::CreateZero());
- outBitangents.resize(vertexCount, AZ::Vector3::CreateZero());
+ outTangents.resize(vertexCount);
+ outBitangents.resize(vertexCount);
+ AZStd::fill(outTangents.begin(), outTangents.end(), AZ::Vector3::CreateZero());
+ AZStd::fill(outBitangents.begin(), outBitangents.end(), AZ::Vector3::CreateZero());
// calculate the base vectors per triangle
for (size_t i = 0; i < triangleCount; ++i)
@@ -192,9 +195,12 @@ namespace NvCloth
const size_t vertexCount = vertices.size();
// Reset results
- outTangents.resize(vertexCount, AZ::Vector3::CreateZero());
- outBitangents.resize(vertexCount, AZ::Vector3::CreateZero());
- outNormals.resize(vertexCount, AZ::Vector3::CreateZero());
+ outTangents.resize(vertexCount);
+ outBitangents.resize(vertexCount);
+ outNormals.resize(vertexCount);
+ AZStd::fill(outTangents.begin(), outTangents.end(), AZ::Vector3::CreateZero());
+ AZStd::fill(outBitangents.begin(), outBitangents.end(), AZ::Vector3::CreateZero());
+ AZStd::fill(outNormals.begin(), outNormals.end(), AZ::Vector3::CreateZero());
// calculate the base vectors per triangle
for (size_t i = 0; i < triangleCount; ++i)
diff --git a/Gems/NvCloth/Code/Tests/Components/ClothComponentMesh/ClothConstraintsTest.cpp b/Gems/NvCloth/Code/Tests/Components/ClothComponentMesh/ClothConstraintsTest.cpp
index 5f390ed45d..50ca5c17cd 100644
--- a/Gems/NvCloth/Code/Tests/Components/ClothComponentMesh/ClothConstraintsTest.cpp
+++ b/Gems/NvCloth/Code/Tests/Components/ClothComponentMesh/ClothConstraintsTest.cpp
@@ -124,6 +124,9 @@ namespace UnitTest
const AZStd::vector& motionConstraints = clothConstraints->GetMotionConstraints();
EXPECT_TRUE(motionConstraints.size() == SimulationParticles.size());
+ EXPECT_THAT(motionConstraints[0].GetAsVector3(), IsCloseTolerance(SimulationParticles[0].GetAsVector3(), Tolerance));
+ EXPECT_THAT(motionConstraints[1].GetAsVector3(), IsCloseTolerance(SimulationParticles[1].GetAsVector3(), Tolerance));
+ EXPECT_THAT(motionConstraints[2].GetAsVector3(), IsCloseTolerance(SimulationParticles[2].GetAsVector3(), Tolerance));
EXPECT_NEAR(motionConstraints[0].GetW(), 6.0f, Tolerance);
EXPECT_NEAR(motionConstraints[1].GetW(), 0.0f, Tolerance);
EXPECT_NEAR(motionConstraints[2].GetW(), 0.0f, Tolerance);
@@ -277,6 +280,9 @@ namespace UnitTest
const AZStd::vector& separationConstraints = clothConstraints->GetSeparationConstraints();
EXPECT_TRUE(motionConstraints.size() == newParticles.size());
+ EXPECT_THAT(motionConstraints[0].GetAsVector3(), IsCloseTolerance(newParticles[0].GetAsVector3(), Tolerance));
+ EXPECT_THAT(motionConstraints[1].GetAsVector3(), IsCloseTolerance(newParticles[1].GetAsVector3(), Tolerance));
+ EXPECT_THAT(motionConstraints[2].GetAsVector3(), IsCloseTolerance(newParticles[2].GetAsVector3(), Tolerance));
EXPECT_NEAR(motionConstraints[0].GetW(), 3.0f, Tolerance);
EXPECT_NEAR(motionConstraints[1].GetW(), 1.5f, Tolerance);
EXPECT_NEAR(motionConstraints[2].GetW(), 0.0f, Tolerance);
@@ -285,8 +291,8 @@ namespace UnitTest
EXPECT_NEAR(separationConstraints[0].GetW(), 3.0f, Tolerance);
EXPECT_NEAR(separationConstraints[1].GetW(), 1.5f, Tolerance);
EXPECT_NEAR(separationConstraints[2].GetW(), 0.3f, Tolerance);
- EXPECT_THAT(separationConstraints[0].GetAsVector3(), IsCloseTolerance(AZ::Vector3(-3.03902f, 2.80752f, 3.80752f), Tolerance));
- EXPECT_THAT(separationConstraints[1].GetAsVector3(), IsCloseTolerance(AZ::Vector3(-1.41659f, 0.651243f, -0.348757f), Tolerance));
- EXPECT_THAT(separationConstraints[2].GetAsVector3(), IsCloseTolerance(AZ::Vector3(6.15313f, -0.876132f, 0.123868f), Tolerance));
+ EXPECT_THAT(separationConstraints[0].GetAsVector3(), IsCloseTolerance(AZ::Vector3(0.0f, 3.53553f, 4.53553f), Tolerance));
+ EXPECT_THAT(separationConstraints[1].GetAsVector3(), IsCloseTolerance(AZ::Vector3(0.0f, 2.06066f, 1.06066f), Tolerance));
+ EXPECT_THAT(separationConstraints[2].GetAsVector3(), IsCloseTolerance(AZ::Vector3(1.0f, -3.74767f, -2.74767f), Tolerance));
}
} // namespace UnitTest
From 902bdeb6d6092d0b88066fbb873eaa043c3b788a Mon Sep 17 00:00:00 2001
From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
Date: Thu, 29 Jul 2021 16:50:50 -0700
Subject: [PATCH 12/28] Create RUN target as helpers for the project-centric
workflow (#2520) (#2635)
* Create RUN target as helpers for the project-centric workflow
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
* typo fix
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
* rename target as ".Imported" and create "" as the metatarget that is used for debugging and building in o3de
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
---
Code/Editor/CMakeLists.txt | 2 +
cmake/Platform/Common/Install_common.cmake | 43 ++++++++++++++++++----
cmake/SettingsRegistry.cmake | 7 +---
cmake/install/InstalledTarget.in | 2 +
4 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/Code/Editor/CMakeLists.txt b/Code/Editor/CMakeLists.txt
index 5a846a267a..db6b8e958e 100644
--- a/Code/Editor/CMakeLists.txt
+++ b/Code/Editor/CMakeLists.txt
@@ -163,6 +163,8 @@ ly_add_target(
editor_files.cmake
PLATFORM_INCLUDE_FILES
Platform/${PAL_PLATFORM_NAME}/editor_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
+ TARGET_PROPERTIES
+ LY_INSTALL_GENERATE_RUN_TARGET TRUE
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Core
diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake
index 1ac59ee83f..8058fb5908 100644
--- a/cmake/Platform/Common/Install_common.cmake
+++ b/cmake/Platform/Common/Install_common.cmake
@@ -9,6 +9,15 @@ include(cmake/FileUtil.cmake)
set(CMAKE_INSTALL_MESSAGE NEVER) # Simplify messages to reduce output noise
+define_property(TARGET PROPERTY LY_INSTALL_GENERATE_RUN_TARGET
+ BRIEF_DOCS "Defines if a \"RUN\" targets should be created when installing this target Gem"
+ FULL_DOCS [[
+ Property which is set on targets that should generate a "RUN"
+ target when installed. This \"RUN\" target helps to run the
+ binary from the installed location directly from the IDE.
+ ]]
+)
+
ly_set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Core)
cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory)
@@ -105,15 +114,19 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
set(NAMESPACE_PLACEHOLDER "")
set(NAME_PLACEHOLDER ${TARGET_NAME})
endif()
+ get_target_property(should_create_helper ${TARGET_NAME} LY_INSTALL_GENERATE_RUN_TARGET)
+ if(should_create_helper)
+ set(NAME_PLACEHOLDER ${NAME_PLACEHOLDER}.Imported)
+ endif()
set(TARGET_TYPE_PLACEHOLDER "")
- get_target_property(target_type ${NAME_PLACEHOLDER} TYPE)
+ get_target_property(target_type ${TARGET_NAME} TYPE)
# Remove the _LIBRARY since we dont need to pass that to ly_add_targets
string(REPLACE "_LIBRARY" "" TARGET_TYPE_PLACEHOLDER ${target_type})
# For HEADER_ONLY libs we end up generating "INTERFACE" libraries, need to specify HEADERONLY instead
string(REPLACE "INTERFACE" "HEADERONLY" TARGET_TYPE_PLACEHOLDER ${TARGET_TYPE_PLACEHOLDER})
if(TARGET_TYPE_PLACEHOLDER STREQUAL "MODULE")
- get_target_property(gem_module ${NAME_PLACEHOLDER} GEM_MODULE)
+ get_target_property(gem_module ${TARGET_NAME} GEM_MODULE)
if(gem_module)
set(TARGET_TYPE_PLACEHOLDER "GEM_MODULE")
endif()
@@ -146,7 +159,6 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
unset(RUNTIME_DEPENDENCIES_PLACEHOLDER)
endif()
-
get_target_property(inteface_build_dependencies_props ${TARGET_NAME} INTERFACE_LINK_LIBRARIES)
unset(INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER)
if(inteface_build_dependencies_props)
@@ -170,6 +182,23 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
list(REMOVE_DUPLICATES INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER)
string(REPLACE ";" "\n" INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER "${INTERFACE_BUILD_DEPENDENCIES_PLACEHOLDER}")
+ # If the target is an executable/application, add a custom target so we can debug the target in project-centric workflow
+ if(should_create_helper)
+ string(REPLACE ".Imported" "" RUN_TARGET_NAME ${NAME_PLACEHOLDER})
+ set(target_types_with_debugging_helper EXECUTABLE APPLICATION)
+ if(NOT target_type IN_LIST target_types_with_debugging_helper)
+ message(FATAL_ERROR "Cannot generate a RUN target for ${TARGET_NAME}, type is ${target_type}")
+ endif()
+ set(TARGET_RUN_HELPER
+"add_custom_target(${RUN_TARGET_NAME})
+set_target_properties(${RUN_TARGET_NAME} PROPERTIES
+ FOLDER \"CMakePredefinedTargets/SDK\"
+ VS_DEBUGGER_COMMAND \$>
+ VS_DEBUGGER_COMMAND_ARGUMENTS \"--project-path=\${LY_DEFAULT_PROJECT_PATH}\"
+)"
+)
+ endif()
+
# Config file
set(target_file_contents "# Generated by O3DE install\n\n")
if(NOT target_type STREQUAL INTERFACE_LIBRARY)
@@ -182,13 +211,13 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$/${target_library_output_subdirectory}/$")
elseif(target_type STREQUAL SHARED_LIBRARY)
string(APPEND target_file_contents
-"set_property(TARGET ${TARGET_NAME}
+"set_property(TARGET ${NAME_PLACEHOLDER}
APPEND_STRING PROPERTY IMPORTED_IMPLIB
$<$$:\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$/$\"$
)
")
string(APPEND target_file_contents
-"set_property(TARGET ${TARGET_NAME}
+"set_property(TARGET ${NAME_PLACEHOLDER}
PROPERTY IMPORTED_IMPLIB_$>
\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$/$\"
)
@@ -200,11 +229,11 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
if(target_location)
string(APPEND target_file_contents
-"set_property(TARGET ${TARGET_NAME}
+"set_property(TARGET ${NAME_PLACEHOLDER}
APPEND_STRING PROPERTY IMPORTED_LOCATION
$<$$:${target_location}$
)
-set_property(TARGET ${TARGET_NAME}
+set_property(TARGET ${NAME_PLACEHOLDER}
PROPERTY IMPORTED_LOCATION_$>
${target_location}
)
diff --git a/cmake/SettingsRegistry.cmake b/cmake/SettingsRegistry.cmake
index 934bae4e30..a1e6de73f8 100644
--- a/cmake/SettingsRegistry.cmake
+++ b/cmake/SettingsRegistry.cmake
@@ -158,10 +158,6 @@ function(ly_delayed_generate_settings_registry)
message(FATAL_ERROR "Dependency ${gem_target} from ${target} does not exist")
endif()
- get_property(has_manually_added_dependencies TARGET ${gem_target} PROPERTY MANUALLY_ADDED_DEPENDENCIES SET)
- get_target_property(target_type ${gem_target} TYPE)
-
-
ly_get_gem_module_root(gem_module_root ${gem_target})
file(RELATIVE_PATH gem_module_root_relative_to_engine_root ${LY_ROOT_FOLDER} ${gem_module_root})
@@ -179,7 +175,8 @@ function(ly_delayed_generate_settings_registry)
list(JOIN target_gem_dependencies_names ",\n" target_gem_dependencies_names)
string(CONFIGURE ${gems_json_template} gem_json @ONLY)
get_target_property(is_imported ${target} IMPORTED)
- if(is_imported)
+ get_target_property(target_type ${target} TYPE)
+ if(is_imported OR target_type STREQUAL UTILITY)
unset(target_dir)
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER ${conf} UCONF)
diff --git a/cmake/install/InstalledTarget.in b/cmake/install/InstalledTarget.in
index 0503fd5f2b..a4f4fa4763 100644
--- a/cmake/install/InstalledTarget.in
+++ b/cmake/install/InstalledTarget.in
@@ -17,6 +17,8 @@ ly_add_target(
@RUNTIME_DEPENDENCIES_PLACEHOLDER@
)
+@TARGET_RUN_HELPER@
+
set(configs @CMAKE_CONFIGURATION_TYPES@)
foreach(config ${configs})
include("@NAME_PLACEHOLDER@_${config}.cmake" OPTIONAL)
From 4b817a6483560691a5f95a34355c87c8972b05ab Mon Sep 17 00:00:00 2001
From: Shirang Jia
Date: Wed, 4 Aug 2021 17:57:47 -0700
Subject: [PATCH 13/28] Include build failure root cause in email notification
(#2491)
Signed-off-by: shiranj
---
scripts/build/Jenkins/Jenkinsfile | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile
index 70618fea78..e693168af0 100644
--- a/scripts/build/Jenkins/Jenkinsfile
+++ b/scripts/build/Jenkins/Jenkinsfile
@@ -577,13 +577,19 @@ finally {
)
}
node('controller') {
- step([
- $class: 'Mailer',
- notifyEveryUnstableBuild: true,
- recipients: emailextrecipients([
+ if("${currentBuild.currentResult}" == "SUCCESS") {
+ emailBody = "${BUILD_URL}\nSuccess!"
+ } else {
+ buildFailure = tm('${BUILD_FAILURE_ANALYZER}')
+ emailBody = "${BUILD_URL}\n${buildFailure}!"
+ }
+ emailext (
+ body: "${emailBody}",
+ subject: "${currentBuild.currentResult}: ${JOB_NAME} - Build # ${BUILD_NUMBER}",
+ recipientProviders: [
[$class: 'RequesterRecipientProvider']
- ])
- ])
+ ]
+ )
}
} catch(Exception e) {
}
From c979ab03385f19970e1a422b23a6d2d9e09d888f Mon Sep 17 00:00:00 2001
From: dmcdiar
Date: Wed, 4 Aug 2021 18:26:43 -0700
Subject: [PATCH 14/28] Keep the mutex locked while processing pending
notifies.
Signed-off-by: dmcdiar
---
.../RHI/Code/Include/Atom/RHI/ObjectCollector.h | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h
index d79a86afea..3f9fed056f 100644
--- a/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h
+++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/ObjectCollector.h
@@ -179,7 +179,6 @@ namespace AZ
{
m_pendingGarbage.push_back({ AZStd::move(m_pendingObjects), m_currentIteration });
}
- m_mutex.unlock();
if (m_pendingNotifies.size())
{
@@ -200,25 +199,19 @@ namespace AZ
}
latestGarbage.m_notifies.insert(latestGarbage.m_notifies.end(), m_pendingNotifies.begin(), m_pendingNotifies.end());
-
- m_mutex.lock();
- m_pendingNotifies.clear();
- m_mutex.unlock();
-
}
else
{
// garbage queue is empty, notify now
- m_mutex.lock();
for (auto& notifyFunction : m_pendingNotifies)
{
notifyFunction();
}
-
- m_pendingNotifies.clear();
- m_mutex.unlock();
}
+
+ m_pendingNotifies.clear();
}
+ m_mutex.unlock();
size_t objectCount = 0;
size_t i = 0;
From d6744690ee281aeda4dfc0759412d2711db13a98 Mon Sep 17 00:00:00 2001
From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
Date: Fri, 6 Aug 2021 15:10:21 -0700
Subject: [PATCH 15/28] platform.h cleanup
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
---
Code/Editor/Include/IObjectManager.h | 1 +
Code/Editor/Objects/ObjectLoader.h | 2 +
.../PerforcePlugin/PerforceSourceControl.cpp | 1 +
Code/Legacy/CryCommon/AndroidSpecific.h | 1 -
Code/Legacy/CryCommon/AppleSpecific.h | 7 -
Code/Legacy/CryCommon/BitFiddling.h | 11 -
Code/Legacy/CryCommon/CryArray.h | 18 +-
Code/Legacy/CryCommon/CryAssert.h | 3 +-
Code/Legacy/CryCommon/CrySizer.h | 4 +-
.../Legacy/CryCommon/CryThreadImpl_pthreads.h | 8 +-
Code/Legacy/CryCommon/CryThreadImpl_windows.h | 2 +-
Code/Legacy/CryCommon/CryThread_pthreads.h | 2 +-
Code/Legacy/CryCommon/CryThread_windows.h | 2 +-
Code/Legacy/CryCommon/IFunctorBase.h | 1 +
Code/Legacy/CryCommon/IMaterial.h | 1 +
Code/Legacy/CryCommon/ISystem.h | 2 +-
Code/Legacy/CryCommon/Linux32Specific.h | 1 -
Code/Legacy/CryCommon/Linux64Specific.h | 1 -
Code/Legacy/CryCommon/LinuxSpecific.h | 17 -
Code/Legacy/CryCommon/MTPseudoRandom.cpp | 2 +-
Code/Legacy/CryCommon/ProjectDefines.h | 186 ++-----
Code/Legacy/CryCommon/Win32specific.h | 1 -
Code/Legacy/CryCommon/Win64specific.h | 1 -
Code/Legacy/CryCommon/WinBase.cpp | 41 --
Code/Legacy/CryCommon/platform.h | 477 ++----------------
Code/Legacy/CryCommon/platform_impl.cpp | 53 --
Code/Legacy/CryCommon/smartptr.h | 13 +-
Code/Legacy/CrySystem/IDebugCallStack.cpp | 2 +-
Code/Legacy/CrySystem/SystemInit.cpp | 2 +-
Code/Legacy/CrySystem/SystemWin32.cpp | 39 +-
.../CrySystem/ViewSystem/ViewSystem.cpp | 2 +-
Code/Legacy/CrySystem/XML/xml.cpp | 2 +-
.../Source/Animation/UiAnimationSystem.cpp | 8 +-
Gems/Maestro/Code/Source/Cinematics/Movie.cpp | 8 +-
34 files changed, 145 insertions(+), 777 deletions(-)
diff --git a/Code/Editor/Include/IObjectManager.h b/Code/Editor/Include/IObjectManager.h
index ce9d69681b..efc1955a56 100644
--- a/Code/Editor/Include/IObjectManager.h
+++ b/Code/Editor/Include/IObjectManager.h
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
// forward declarations.
class CEntityObject;
diff --git a/Code/Editor/Objects/ObjectLoader.h b/Code/Editor/Objects/ObjectLoader.h
index ccfaeb78f0..fc526970dd 100644
--- a/Code/Editor/Objects/ObjectLoader.h
+++ b/Code/Editor/Objects/ObjectLoader.h
@@ -15,6 +15,8 @@
#include "Util/GuidUtil.h"
#include "ErrorReport.h"
+#include
+
class CPakFile;
class CErrorRecord;
struct IObjectManager;
diff --git a/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp b/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
index 581f9a576d..1ea70e8c22 100644
--- a/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
+++ b/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
@@ -9,6 +9,7 @@
#include "CryFile.h"
#include "PerforceSourceControl.h"
#include "PasswordDlg.h"
+#include
#include
#include
diff --git a/Code/Legacy/CryCommon/AndroidSpecific.h b/Code/Legacy/CryCommon/AndroidSpecific.h
index 0cb4a6786c..a0f57553ca 100644
--- a/Code/Legacy/CryCommon/AndroidSpecific.h
+++ b/Code/Legacy/CryCommon/AndroidSpecific.h
@@ -35,7 +35,6 @@
// to what some structs/classes need.
#define CRY_FORCE_MALLOC_NEW_ALIGN
-#define DEBUG_BREAK raise(SIGTRAP)
#define RC_EXECUTABLE "rc"
#define USE_CRT 1
#define SIZEOF_PTR 4
diff --git a/Code/Legacy/CryCommon/AppleSpecific.h b/Code/Legacy/CryCommon/AppleSpecific.h
index 4d17c18bac..ed76de8986 100644
--- a/Code/Legacy/CryCommon/AppleSpecific.h
+++ b/Code/Legacy/CryCommon/AppleSpecific.h
@@ -18,7 +18,6 @@
#endif
-#define DEBUG_BREAK __builtin_trap()
#define RC_EXECUTABLE "rc"
//////////////////////////////////////////////////////////////////////////
@@ -52,12 +51,6 @@
#define __COUNTER__ __LINE__
#endif
-#ifdef __FUNC__
-#undef __FUNC__
-#endif
-
-#define __FUNC__ __func__
-
typedef void* LPVOID;
#define VOID void
#define PVOID void*
diff --git a/Code/Legacy/CryCommon/BitFiddling.h b/Code/Legacy/CryCommon/BitFiddling.h
index 901dd0a49a..342aad9a82 100644
--- a/Code/Legacy/CryCommon/BitFiddling.h
+++ b/Code/Legacy/CryCommon/BitFiddling.h
@@ -36,7 +36,6 @@ ILINE uint32 countLeadingZeros32(uint32 x)
{
DWORD result = 32 ^ 31; // assumes result is unmodified if _BitScanReverse returns 0
_BitScanReverse(&result, x);
- PREFAST_SUPPRESS_WARNING(6102);
result ^= 31; // needed because the index is from LSB (whereas all other implementations are from MSB)
return result;
}
@@ -73,16 +72,6 @@ inline bool IsPowerOfTwo(TInteger x)
return (x & (x - 1)) == 0;
}
-// compile time version of IsPowerOfTwo, useful for STATIC_CHECK
-template
-struct IsPowerOfTwoCompileTime
-{
- enum
- {
- IsPowerOfTwo = ((nValue & (nValue - 1)) == 0)
- };
-};
-
inline uint32 NextPower2(uint32 n)
{
n--;
diff --git a/Code/Legacy/CryCommon/CryArray.h b/Code/Legacy/CryCommon/CryArray.h
index b304df28af..5b4684fdd2 100644
--- a/Code/Legacy/CryCommon/CryArray.h
+++ b/Code/Legacy/CryCommon/CryArray.h
@@ -15,24 +15,10 @@
//---------------------------------------------------------------------------
// Convenient iteration macros
-#define for_iter(IT, it, b, e) for (IT it = (b), _e = (e); it != _e; ++it)
-#define for_container(CT, it, cont) for_iter (CT::iterator, it, (cont).begin(), (cont).end())
#define for_ptr(T, it, b, e) for (T* it = (b), * _e = (e); it != _e; ++it)
-#define for_array_ptr(T, it, arr) for_ptr (T, it, (arr).begin(), (arr).end())
-
-#define for_array(i, arr) for (int i = 0, _e = (arr).size(); i < _e; i++)
-#define for_all(cont) for_array (_i, cont) cont[_i]
-
-//---------------------------------------------------------------------------
-// Stack array helper
-#define ALIGNED_STACK_ARRAY(T, name, size, alignment) \
- PREFAST_SUPPRESS_WARNING(6255) \
- T * name = (T*) alloca((size) * sizeof(T) + alignment - 1); \
- name = Align(name, alignment);
-
-#define STACK_ARRAY(T, name, size) \
- ALIGNED_STACK_ARRAY(T, name, size, alignof(T)) \
+#define for_array_ptr(T, it, arr) for_ptr (T, it, (arr).begin(), (arr).end())
+#define for_array(i, arr) for (int i = 0, _e = (arr).size(); i < _e; i++)
//---------------------------------------------------------------------------
// Specify semantics for moving objects.
diff --git a/Code/Legacy/CryCommon/CryAssert.h b/Code/Legacy/CryCommon/CryAssert.h
index 1cb5d37c43..1494654d87 100644
--- a/Code/Legacy/CryCommon/CryAssert.h
+++ b/Code/Legacy/CryCommon/CryAssert.h
@@ -71,7 +71,6 @@
#if defined(USE_CRY_ASSERT) && CRYASSERT_H_TRAIT_USE_CRY_ASSERT_MESSAGE
void CryAssertTrace(const char*, ...);
bool CryAssert(const char*, const char*, unsigned int, bool*);
-void CryDebugBreak();
#define CRY_ASSERT(condition) CRY_ASSERT_MESSAGE(condition, NULL)
@@ -86,7 +85,7 @@ void CryDebugBreak();
CryAssertTrace parenthese_message; \
if (CryAssert(#condition, __FILE__, __LINE__, &s_bIgnoreAssert)) \
{ \
- DEBUG_BREAK; \
+ AZ::Debug::Trace::Break(); \
} \
} \
} while (0)
diff --git a/Code/Legacy/CryCommon/CrySizer.h b/Code/Legacy/CryCommon/CrySizer.h
index 9301360bd5..583de5bee8 100644
--- a/Code/Legacy/CryCommon/CrySizer.h
+++ b/Code/Legacy/CryCommon/CrySizer.h
@@ -581,7 +581,7 @@ protected:
// use this to push (and automatically pop) the sizer component name at the beginning of the
// getSize() function
-#define SIZER_COMPONENT_NAME(pSizerPointer, szComponentName) PREFAST_SUPPRESS_WARNING(6246) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, false)
-#define SIZER_SUBCOMPONENT_NAME(pSizerPointer, szComponentName) PREFAST_SUPPRESS_WARNING(6246) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, true)
+#define SIZER_COMPONENT_NAME(pSizerPointer, szComponentName) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, false)
+#define SIZER_SUBCOMPONENT_NAME(pSizerPointer, szComponentName) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, true)
#endif // CRYINCLUDE_CRYCOMMON_CRYSIZER_H
diff --git a/Code/Legacy/CryCommon/CryThreadImpl_pthreads.h b/Code/Legacy/CryCommon/CryThreadImpl_pthreads.h
index c94d4fca90..c3dee7339f 100644
--- a/Code/Legacy/CryCommon/CryThreadImpl_pthreads.h
+++ b/Code/Legacy/CryCommon/CryThreadImpl_pthreads.h
@@ -14,13 +14,7 @@
#include "CryThread_pthreads.h"
-#if PLATFORM_SUPPORTS_THREADLOCAL
-THREADLOCAL CrySimpleThreadSelf
-* CrySimpleThreadSelf::m_Self = NULL;
-#else
-TLS_DEFINE(CrySimpleThreadSelf*, g_CrySimpleThreadSelf)
-#endif
-
+AZ_THREAD_LOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
//////////////////////////////////////////////////////////////////////////
// CryEvent(Timed) implementation
diff --git a/Code/Legacy/CryCommon/CryThreadImpl_windows.h b/Code/Legacy/CryCommon/CryThreadImpl_windows.h
index 5cf970414d..4ddbaedac5 100644
--- a/Code/Legacy/CryCommon/CryThreadImpl_windows.h
+++ b/Code/Legacy/CryCommon/CryThreadImpl_windows.h
@@ -20,7 +20,7 @@ struct SThreadNameDesc
DWORD dwFlags;
};
-THREADLOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
+AZ_THREAD_LOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
//////////////////////////////////////////////////////////////////////////
CryEvent::CryEvent()
diff --git a/Code/Legacy/CryCommon/CryThread_pthreads.h b/Code/Legacy/CryCommon/CryThread_pthreads.h
index 72b29344ec..2c6b389dbb 100644
--- a/Code/Legacy/CryCommon/CryThread_pthreads.h
+++ b/Code/Legacy/CryCommon/CryThread_pthreads.h
@@ -672,7 +672,7 @@ protected:
m_Self = pSelf;
}
private:
- static THREADLOCAL CrySimpleThreadSelf* m_Self;
+ static AZ_THREAD_LOCAL CrySimpleThreadSelf* m_Self;
#else
diff --git a/Code/Legacy/CryCommon/CryThread_windows.h b/Code/Legacy/CryCommon/CryThread_windows.h
index cc09cc530b..98517133c1 100644
--- a/Code/Legacy/CryCommon/CryThread_windows.h
+++ b/Code/Legacy/CryCommon/CryThread_windows.h
@@ -189,7 +189,7 @@ public:
virtual ~CrySimpleThreadSelf();
protected:
void StartThread(unsigned (__stdcall * func)(void*), void* argList);
- static THREADLOCAL CrySimpleThreadSelf* m_Self;
+ static AZ_THREAD_LOCAL CrySimpleThreadSelf* m_Self;
private:
CrySimpleThreadSelf(const CrySimpleThreadSelf&);
CrySimpleThreadSelf& operator = (const CrySimpleThreadSelf&);
diff --git a/Code/Legacy/CryCommon/IFunctorBase.h b/Code/Legacy/CryCommon/IFunctorBase.h
index 2a8af50d33..1ac37a0e47 100644
--- a/Code/Legacy/CryCommon/IFunctorBase.h
+++ b/Code/Legacy/CryCommon/IFunctorBase.h
@@ -14,6 +14,7 @@
#define CRYINCLUDE_CRYCOMMON_IFUNCTORBASE_H
#pragma once
+#include
// Base class for functor storage.
// Not intended for direct usage.
diff --git a/Code/Legacy/CryCommon/IMaterial.h b/Code/Legacy/CryCommon/IMaterial.h
index 1faee0eef9..f1967324d8 100644
--- a/Code/Legacy/CryCommon/IMaterial.h
+++ b/Code/Legacy/CryCommon/IMaterial.h
@@ -37,6 +37,7 @@ struct IRenderMesh;
#include
#include
#include
+#include
#ifdef MAX_SUB_MATERIALS
// This checks that the values are in sync in the different files.
diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h
index d934995b4d..7cea690687 100644
--- a/Code/Legacy/CryCommon/ISystem.h
+++ b/Code/Legacy/CryCommon/ISystem.h
@@ -1419,7 +1419,7 @@ namespace Detail
} DummyStaticInstance; \
if (!(gEnv->pConsole != 0 ? gEnv->pConsole->Register(&DummyStaticInstance) : 0)) \
{ \
- DEBUG_BREAK; \
+ AZ::Debug::Trace::Break(); \
CryFatalError("Can not register dummy CVar"); \
} \
} while (0)
diff --git a/Code/Legacy/CryCommon/Linux32Specific.h b/Code/Legacy/CryCommon/Linux32Specific.h
index b3f06a80b7..e66838f431 100644
--- a/Code/Legacy/CryCommon/Linux32Specific.h
+++ b/Code/Legacy/CryCommon/Linux32Specific.h
@@ -18,7 +18,6 @@
#define _CPU_X86
//#define _CPU_SSE
-#define DEBUG_BREAK raise(SIGTRAP)
#define RC_EXECUTABLE "rc"
#define USE_CRT 1
#define SIZEOF_PTR 4
diff --git a/Code/Legacy/CryCommon/Linux64Specific.h b/Code/Legacy/CryCommon/Linux64Specific.h
index 11b526ee4b..0aa9321025 100644
--- a/Code/Legacy/CryCommon/Linux64Specific.h
+++ b/Code/Legacy/CryCommon/Linux64Specific.h
@@ -20,7 +20,6 @@
#define _CPU_AMD64
#define _CPU_SSE
-#define DEBUG_BREAK ::raise(SIGTRAP)
#define RC_EXECUTABLE "rc"
#define USE_CRT 1
#define SIZEOF_PTR 8
diff --git a/Code/Legacy/CryCommon/LinuxSpecific.h b/Code/Legacy/CryCommon/LinuxSpecific.h
index 5fc1f7b801..cbffae5957 100644
--- a/Code/Legacy/CryCommon/LinuxSpecific.h
+++ b/Code/Legacy/CryCommon/LinuxSpecific.h
@@ -42,23 +42,6 @@
#include
#include
-#ifdef __FUNC__
-#undef __FUNC__
-#endif
-#if defined(__GNUC__) || defined(__clang__)
-#define __FUNC__ __func__
-#else
-#define __FUNC__ \
- ({ \
- static char __f[sizeof(__PRETTY_FUNCTION__) + 1]; \
- strcpy(__f, __PRETTY_FUNCTION__); \
- char* __p = (char*)strchr(__f, '('); \
- *__p = 0; \
- while (*(__p) != ' ' && __p != (__f - 1)) {--__p; } \
- (__p + 1); \
- })
-#endif
-
typedef void* LPVOID;
#define VOID void
#define PVOID void*
diff --git a/Code/Legacy/CryCommon/MTPseudoRandom.cpp b/Code/Legacy/CryCommon/MTPseudoRandom.cpp
index 6f163e682f..f8a3950ff0 100644
--- a/Code/Legacy/CryCommon/MTPseudoRandom.cpp
+++ b/Code/Legacy/CryCommon/MTPseudoRandom.cpp
@@ -63,7 +63,7 @@ void CMTRand_int32::seed(const uint32* array, int size) // init by array
}
for (int k = n - 1; k; --k)
{
- PREFAST_SUPPRESS_WARNING(6385) PREFAST_SUPPRESS_WARNING(6386) m_nState[i] = (m_nState[i] ^ ((m_nState[i - 1] ^ (m_nState[i - 1] >> 30)) * 1566083941UL)) - i;
+ m_nState[i] = (m_nState[i] ^ ((m_nState[i - 1] ^ (m_nState[i - 1] >> 30)) * 1566083941UL)) - i;
if ((++i) == n)
{
m_nState[0] = m_nState[n - 1];
diff --git a/Code/Legacy/CryCommon/ProjectDefines.h b/Code/Legacy/CryCommon/ProjectDefines.h
index 3d635c491c..eda5bb8b5f 100644
--- a/Code/Legacy/CryCommon/ProjectDefines.h
+++ b/Code/Legacy/CryCommon/ProjectDefines.h
@@ -16,10 +16,6 @@
#include "BaseTypes.h"
#include
-#if defined(_RELEASE) && !defined(RELEASE)
- #define RELEASE
-#endif
-
// Section dictionary
#if defined(AZ_RESTRICTED_PLATFORM)
#define PROJECTDEFINES_H_SECTION_STATS_AGENT 1
@@ -31,57 +27,51 @@
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_STATS_AGENT
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#elif defined(WIN32) || defined(WIN64)
-#if !defined(_RELEASE) || defined(PERFORMANCE_BUILD)
-#define ENABLE_STATS_AGENT
-#endif
+ #if !defined(_RELEASE) || defined(PERFORMANCE_BUILD)
+ #define ENABLE_STATS_AGENT
+ #endif
#endif
-// The following definitions are used by Sandbox and RC to determine which platform support is needed
-#define TOOLS_SUPPORT_POWERVR
-#define TOOLS_SUPPORT_ETC2COMP
// Type used for vertex indices
// WARNING: If you change this typedef, you need to update AssetProcessorPlatformConfig.ini to convert cgf and abc files to the proper index format.
#if defined(RESOURCE_COMPILER)
-typedef uint32 vtx_idx;
-#define AZ_RESTRICTED_SECTION_IMPLEMENTED
+ typedef uint32 vtx_idx;
+ #define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(MOBILE)
-typedef uint16 vtx_idx;
-#define AZ_RESTRICTED_SECTION_IMPLEMENTED
+ typedef uint16 vtx_idx;
+ #define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_VTX_IDX
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
+ #undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
-// Uncomment one of the two following typedefs:
-typedef uint32 vtx_idx;
-//typedef uint16 vtx_idx;
+ // Uncomment one of the two following typedefs:
+ typedef uint32 vtx_idx;
+ //typedef uint16 vtx_idx;
#endif
-// 0=off, 1=on
-#define TERRAIN_USE_CIE_COLORSPACE 0
-
// When non-zero, const cvar accesses (by name) are logged in release-mode on consoles.
// This can be used to find non-optimal usage scenario's, where the constant should be used directly instead.
// Since read accesses tend to be used in flow-control logic, constants allow for better optimization by the compiler.
#define LOG_CONST_CVAR_ACCESS 0
#if defined(WIN32) || defined(WIN64) || LOG_CONST_CVAR_ACCESS
-#define RELEASE_LOGGING
+ #define RELEASE_LOGGING
#endif
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
-#define EXCLUDE_NORMAL_LOG
+ #define EXCLUDE_NORMAL_LOG
#endif
// Add the "REMOTE_ASSET_PROCESSOR" define except in release
// this makes it so that asset processor functions. Without this, all assets must be present and on local media
// with this, the asset processor can be used to remotely process assets.
#if !defined(_RELEASE)
-# define REMOTE_ASSET_PROCESSOR
+ #define REMOTE_ASSET_PROCESSOR
#endif
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD))
@@ -93,132 +83,68 @@ typedef uint32 vtx_idx;
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_TRAITS
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#else
-#define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
-#if !defined(LINUX) && !defined(APPLE)
-#define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
-#endif
-#if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
-#define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
-#endif
-#define PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION 1
-#if defined(WIN32)
-#define PROJECTDEFINES_H_TRAIT_USE_SVO_GI 1
-#endif
-#if defined(APPLE) || defined(LINUX)
-#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS 1
-#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_UNIX_PATHS 1
-#endif
-#endif
-
-#define USE_GLOBAL_BUCKET_ALLOCATOR
-
-#ifdef IS_PROSDK
-# define USING_TAGES_SECURITY // Wrapper for TGVM security
-# if defined(LINUX) || defined(APPLE)
-# error LINUX and Mac does not support evaluation version
-# endif
-#endif
-
-#ifdef USING_TAGES_SECURITY
-# define TAGES_EXPORT __declspec(dllexport)
-#else
-# define TAGES_EXPORT
-#endif // USING_TAGES_SECURITY
-// test -------------------------------------
-
-#define _DATAPROBE
-
-
-
-//This feature allows automatic crash submission to JIRA, but does not work outside of O3DE
-//Note: This #define will be commented out during code export
-#define ENABLE_CRASH_HANDLER
-
-#if !defined(PHYSICS_STACK_SIZE)
-# define PHYSICS_STACK_SIZE (128U << 10)
+ #define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
+ #if !defined(LINUX) && !defined(APPLE)
+ #define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
+ #endif
+ #if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
+ #define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
+ #endif
+ #define PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION 1
+ #if defined(WIN32)
+ #define PROJECTDEFINES_H_TRAIT_USE_SVO_GI 1
+ #endif
+ #if defined(APPLE) || defined(LINUX)
+ #define AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS 1
+ #define AZ_LEGACY_CRYCOMMON_TRAIT_USE_UNIX_PATHS 1
+ #endif
#endif
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) && !defined(RESOURCE_COMPILER)
-#ifndef ENABLE_PROFILING_CODE
- #define ENABLE_PROFILING_CODE
-#endif
-#if !(defined(SANDBOX_EXPORTS) || defined(PLUGIN_EXPORTS) || (defined(AZ_MONOLITHIC_BUILD) && PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS))
- #define ENABLE_PROFILING_MARKERS
-#endif
+ #ifndef ENABLE_PROFILING_CODE
+ #define ENABLE_PROFILING_CODE
+ #endif
-//lightweight profilers, disable for submissions, disables displayinfo inside 3dengine as well
-#ifndef ENABLE_LW_PROFILERS
- #define ENABLE_LW_PROFILERS
-#endif
-#endif
-
-#if defined(ENABLE_PROFILING_CODE)
-#define ENABLE_ART_RT_TIME_ESTIMATE
-#endif
-
-#if defined(ENABLE_PROFILING_CODE) && !defined(_RELEASE)
- #define FMOD_STREAMING_DEBUGGING 1
-#endif
-
-#if defined(WIN32) || defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX)
-#define FLARES_SUPPORT_EDITING
+ //lightweight profilers, disable for submissions, disables displayinfo inside 3dengine as well
+ #ifndef ENABLE_LW_PROFILERS
+ #define ENABLE_LW_PROFILERS
+ #endif
#endif
// Reflect texture slot information - only used in the editor
#if defined(WIN32) || defined(WIN64) || defined(AZ_PLATFORM_MAC)
-#define SHADER_REFLECT_TEXTURE_SLOTS 1
+ #define SHADER_REFLECT_TEXTURE_SLOTS 1
#else
-#define SHADER_REFLECT_TEXTURE_SLOTS 0
+ #define SHADER_REFLECT_TEXTURE_SLOTS 0
#endif
-// these enable and disable certain net features to give compatibility between PCs and consoles / profile and performance builds
-#define PC_CONSOLE_NET_COMPATIBLE 0
-#define PROFILE_PERFORMANCE_NET_COMPATIBLE 0
-
-#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) && !PROFILE_PERFORMANCE_NET_COMPATIBLE
-#define USE_LAGOMETER (1)
-#else
-#define USE_LAGOMETER (0)
-#endif
-
-// enable this in order to support old style material names in old data ("engine/material.mtl" or "mygame/material.mtl" as opposed to just "material.mtl")
-// previously, material names could have the game folder in it, but this is not necessary anymore and would not work with things like gems
-// note that if you use any older projects such as GameSDK this should remain enabled
-#define SUPPORT_LEGACY_MATERIAL_NAMES
-
-// Enable additional structures and code for sprite motion blur. Currently non-functional and disabled
-// #define PARTICLE_MOTION_BLUR
-
-// a special ticker thread to run during load and unload of levels
-#define USE_NETWORK_STALL_TICKER_THREAD
-
#if !defined(MOBILE)
-//---------------------------------------------------------------------
-// Enable Tessellation Features
-// (displacement mapping, subdivision, water tessellation)
-//---------------------------------------------------------------------
-// Modules : 3DEngine, Renderer
-// Depends on: DX11
+ //---------------------------------------------------------------------
+ // Enable Tessellation Features
+ // (displacement mapping, subdivision, water tessellation)
+ //---------------------------------------------------------------------
+ // Modules : 3DEngine, Renderer
+ // Depends on: DX11
-// Global tessellation feature flag
+ // Global tessellation feature flag
#define TESSELLATION
#ifdef TESSELLATION
-// Specific features flags
+ // Specific features flags
#define WATER_TESSELLATION
#define PARTICLES_TESSELLATION
#if PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION
-// Mesh tessellation (displacement, smoothing, subd)
+ // Mesh tessellation (displacement, smoothing, subd)
#define MESH_TESSELLATION
-// Mesh tessellation also in motion blur passes
+ // Mesh tessellation also in motion blur passes
#define MOTIONBLUR_TESSELLATION
#endif
-// Dependencies
+ // Dependencies
#ifdef MESH_TESSELLATION
#define MESH_TESSELLATION_ENGINE
#endif
- #ifndef NULL_RENDERER
+ #ifndef NULL_RENDERER
#ifdef WATER_TESSELLATION
#define WATER_TESSELLATION_RENDERER
#endif
@@ -230,7 +156,7 @@ typedef uint32 vtx_idx;
#endif
#if defined(WATER_TESSELLATION_RENDERER) || defined(PARTICLES_TESSELLATION_RENDERER) || defined(MESH_TESSELLATION_RENDERER)
-// Common tessellation flag enabling tessellation stages in renderer
+ // Common tessellation flag enabling tessellation stages in renderer
#define TESSELLATION_RENDERER
#endif
#endif // !NULL_RENDERER
@@ -249,14 +175,8 @@ typedef uint32 vtx_idx;
#endif
#if defined(ENABLE_PROFILING_CODE)
-# define USE_DISK_PROFILER
-# define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
-#endif
-
-#if PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES && !defined(NULL_RENDERER)
- #define GPU_PARTICLES 1
-#else
- #define GPU_PARTICLES 0
+ #define USE_DISK_PROFILER
+ #define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
#endif
// The maximum number of joints in an animation
diff --git a/Code/Legacy/CryCommon/Win32specific.h b/Code/Legacy/CryCommon/Win32specific.h
index 650a4946a0..0519bb1022 100644
--- a/Code/Legacy/CryCommon/Win32specific.h
+++ b/Code/Legacy/CryCommon/Win32specific.h
@@ -23,7 +23,6 @@
#define ILINE __forceinline
#endif
-#define DEBUG_BREAK _asm { int 3 }
#define RC_EXECUTABLE "rc.exe"
#define DEPRECATED __declspec(deprecated)
#define TYPENAME(x) typeid(x).name()
diff --git a/Code/Legacy/CryCommon/Win64specific.h b/Code/Legacy/CryCommon/Win64specific.h
index a3cb11ce32..b1e86f9250 100644
--- a/Code/Legacy/CryCommon/Win64specific.h
+++ b/Code/Legacy/CryCommon/Win64specific.h
@@ -19,7 +19,6 @@
#define _CPU_SSE
#define ILINE __forceinline
-#define DEBUG_BREAK CryDebugBreak()
#define RC_EXECUTABLE "rc.exe"
#define DEPRECATED __declspec(deprecated)
#define TYPENAME(x) typeid(x).name()
diff --git a/Code/Legacy/CryCommon/WinBase.cpp b/Code/Legacy/CryCommon/WinBase.cpp
index 15146fbac1..2861b4470e 100644
--- a/Code/Legacy/CryCommon/WinBase.cpp
+++ b/Code/Legacy/CryCommon/WinBase.cpp
@@ -1127,20 +1127,6 @@ void CrySleep(unsigned int dwMilliseconds)
Sleep(dwMilliseconds);
}
-//////////////////////////////////////////////////////////////////////////
-void CryLowLatencySleep(unsigned int dwMilliseconds)
-{
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION WINBASE_CPP_SECTION_6
- #include AZ_RESTRICTED_FILE(WinBase_cpp)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
- CrySleep(dwMilliseconds);
-#endif
-}
-
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
@@ -1284,14 +1270,6 @@ int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
#endif
}
-//////////////////////////////////////////////////////////////////////////
-short CryGetAsyncKeyState(int vKey)
-{
- //TODO: implement
- CRY_ASSERT_MESSAGE(0, "CryGetAsyncKeyState not implemented yet");
- return 0;
-}
-
#if defined(LINUX) || defined(APPLE) || defined(DEFINE_CRY_INTERLOCKED_INCREMENT)
//[K01]: http://www.memoryhole.net/kyle/2007/05/atomic_incrementing.html
//http://forums.devx.com/archive/index.php/t-160558.html
@@ -1382,10 +1360,6 @@ threadID CryGetCurrentThreadId()
return GetCurrentThreadId();
}
-void CryDebugBreak()
-{
- __builtin_trap();
-}
#endif//LINUX APPLE
#if defined(APPLE) || defined(LINUX)
@@ -1398,11 +1372,6 @@ DLL_EXPORT void OutputDebugString(const char* outputString)
#endif
}
-DLL_EXPORT void DebugBreak()
-{
- CryDebugBreak();
-}
-
#endif
// This code does not have a long life span and will be replaced soon
@@ -1626,16 +1595,6 @@ DWORD GetFileAttributes(LPCSTR lpFileName)
return (ret == 0) ? FILE_ATTRIBUTE_NORMAL : ret;//return file attribute normal as the default value, must only be set if no other attributes have been found
}
-uint32 CryGetFileAttributes(const char* lpFileName)
-{
-
- string fn = lpFileName;
- adaptFilenameToLinux(fn);
- const char* buffer = fn.c_str();
- return GetFileAttributes(buffer);
-
-}
-
__finddata64_t::~__finddata64_t()
{
if (m_Dir != FS_DIR_NULL)
diff --git a/Code/Legacy/CryCommon/platform.h b/Code/Legacy/CryCommon/platform.h
index 6aad8dd043..fb96056beb 100644
--- a/Code/Legacy/CryCommon/platform.h
+++ b/Code/Legacy/CryCommon/platform.h
@@ -7,136 +7,31 @@
*/
-// Description : Platform dependend stuff.
+// Description : Platform dependent stuff.
// Include this file instead of windows h
#pragma once
#if defined(AZ_RESTRICTED_PLATFORM)
#undef AZ_RESTRICTED_SECTION
-#define PLATFORM_H_SECTION_1 1
-#define PLATFORM_H_SECTION_2 2
#define PLATFORM_H_SECTION_3 3
-#define PLATFORM_H_SECTION_4 4
#define PLATFORM_H_SECTION_5 5
#define PLATFORM_H_SECTION_6 6
#define PLATFORM_H_SECTION_7 7
#define PLATFORM_H_SECTION_8 8
-#define PLATFORM_H_SECTION_9 9
#define PLATFORM_H_SECTION_10 10
#define PLATFORM_H_SECTION_11 11
#define PLATFORM_H_SECTION_12 12
#define PLATFORM_H_SECTION_13 13
#define PLATFORM_H_SECTION_14 14
-#define PLATFORM_H_SECTION_15 15
#endif
-// certain C++ features are not available in some compiler versions
-// turn them off here:
-// #define _ALLOW_KEYWORD_MACROS
-// #define _DISALLOW_INITIALIZER_LISTS
-// #define _DISALLOW_ENUM_CLASS
-
-#if defined(_MSC_VER)
- #define _ALLOW_KEYWORD_MACROS
-
- #define alignof _alignof
- #if !defined(_HAS_EXCEPTIONS)
- #define _HAS_EXCEPTIONS 0
- #endif
-#elif defined(__GNUC__)
- #define alignof __alignof__
-#endif
-
-// Alignment|InitializerList support.
-#define _ALLOW_INITIALIZER_LISTS
-
#if (defined(LINUX) && !defined(ANDROID)) || defined(APPLE)
-#define _FILE_OFFSET_BITS 64 // define large file support > 2GB
+ #define _FILE_OFFSET_BITS 64 // define large file support > 2GB
#endif
#include
-#include
-
-#if defined(_MSC_VER) // We want the class name to be included, but __FUNCTION__ doesn't contain that on GCC/clang
- #define __FUNC__ __FUNCTION__
-#else
- #define __FUNC__ __PRETTY_FUNCTION__
-#endif
-
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_1
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#elif defined(_DEBUG) && !defined(LINUX) && !defined(APPLE)
- #include
-#endif
-
-#define RESTRICT_POINTER __restrict
-
-// we have to use it because of VS doesn't support restrict reference variables
-#if defined(APPLE) || defined(LINUX)
- #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
- #define GCC411_OR_LATER
- #endif
- #define RESTRICT_REFERENCE __restrict
-#else
- #define RESTRICT_REFERENCE
-#endif
-
-
-#ifndef CHECK_REFERENCE_COUNTS //define that in your StdAfx.h to override per-project
-# define CHECK_REFERENCE_COUNTS 0 //default value
-#endif
-
-#if CHECK_REFERENCE_COUNTS
-# define CHECK_REFCOUNT_CRASH(x) { if (!(x)) {*((int*)0) = 0; } \
-}
-#else
-# define CHECK_REFCOUNT_CRASH(x)
-#endif
-
-#ifndef GARBAGE_MEMORY_ON_FREE //define that in your StdAfx.h to override per-project
-# define GARBAGE_MEMORY_ON_FREE 0 //default value
-#endif
-
-#if GARBAGE_MEMORY_ON_FREE
-# ifndef GARBAGE_MEMORY_RANDOM //define that in your StdAfx.h to override per-project
-# define GARBAGE_MEMORY_RANDOM 1 //0 to change it to progressive pattern
-# endif
-#endif
-
-//////////////////////////////////////////////////////////////////////////
-// Available predefined compiler macros for Visual C++.
-// _MSC_VER // Indicates MS Visual C compiler version
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_2
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
-// _WIN32, _WIN64 // Indicates target OS
-#endif
-// _M_IX86, _M_PPC // Indicates target processor
-// _DEBUG // Building in Debug mode
-// _DLL // Linking with DLL runtime libs
-// _MT // Linking with multi-threaded runtime libs
-//////////////////////////////////////////////////////////////////////////
-
-//
-// Translate some predefined macros.
-//
-
-// NDEBUG disables std asserts, etc.
-// Define it automatically if not compiling with Debug libs, or with ADEBUG flag.
-#if !defined(_DEBUG) && !defined(ADEBUG) && !defined(NDEBUG)
- #define NDEBUG
-#endif
-
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_3
#include AZ_RESTRICTED_FILE(platform_h)
@@ -147,44 +42,6 @@
#define CONSOLE
#endif
-//render thread settings, as this is accessed inside 3dengine and renderer and needs to be compile time defined, we need to do it here
-//enable this macro to strip out the overhead for render thread
-// #define STRIP_RENDER_THREAD
-#ifdef STRIP_RENDER_THREAD
- #define RT_COMMAND_BUF_COUNT 1
-#else
-//can be enhanced to triple buffering, FlushFrame needs to be adjusted and RenderObj would become 132 bytes
- #define RT_COMMAND_BUF_COUNT 2
-#endif
-
-
-// We use WIN macros without _.
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_4
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
-#if defined(_WIN32) && !defined(LINUX32) && !defined(LINUX64) && !defined(APPLE) && !defined(WIN32)
- #define WIN32
-#endif
-#if defined(_WIN64) && !defined(WIN64)
- #define WIN64
-#endif
-#endif
-
-// In Win32 Release we use static linkage
-#ifdef WIN32
- #if !defined(_RELEASE) || defined(RESOURCE_COMPILER) || defined(EDITOR) || defined(_FORCEDLL)
-// All windows targets not in Release built as DLLs.
- #ifndef _USRDLL
- #define _USRDLL
- #endif
- #endif
-
-#endif //WIN32
-
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_5
#include AZ_RESTRICTED_FILE(platform_h)
@@ -205,19 +62,17 @@
#define PRId64 "lld"
#define PRIu64 "llu"
#endif
- #define PLATFORM_I64(x) x##ll
#else
#include
- #define PLATFORM_I64(x) x##i64
#endif
#if !defined(PRISIZE_T)
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_6
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
+ #if defined(AZ_RESTRICTED_PLATFORM)
+ #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_6
+ #include AZ_RESTRICTED_FILE(platform_h)
+ #endif
+ #if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
+ #undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN64)
#define PRISIZE_T "I64u" //size_t defined as unsigned __int64
#elif defined(WIN32) || defined(LINUX32)
@@ -228,13 +83,14 @@
#error "Please defined PRISIZE_T for this platform"
#endif
#endif
+
#if !defined(PRI_THREADID)
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_7
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
+ #if defined(AZ_RESTRICTED_PLATFORM)
+ #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_7
+ #include AZ_RESTRICTED_FILE(platform_h)
+ #endif
+ #if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
+ #undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(MAC) || defined(IOS) && defined(__LP64__) && defined(__LP64__)
#define PRI_THREADID "lld"
#elif defined(LINUX64) || defined(ANDROID)
@@ -243,6 +99,7 @@
#define PRI_THREADID "d"
#endif
#endif
+
#include "ProjectDefines.h" // to get some defines available in every CryEngine project
// Function attribute for printf/scanf-style parameters.
@@ -277,47 +134,6 @@
#define PRINTF_EMPTY_FORMAT ""
#endif
-#if defined(IOS)
-#define USE_PTHREAD_TLS
-#endif
-
-// Storage class modifier for thread local storage.
-// THEADLOCAL should NOT be defined to empty because that creates some
-// really hard to find issues.
-#if !defined(USE_PTHREAD_TLS)
-# define THREADLOCAL AZ_TRAIT_COMPILER_THREAD_LOCAL
-#endif //!defined(USE_PTHREAD_TLS)
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// define Read Write Barrier macro needed for lockless programming
-//////////////////////////////////////////////////////////////////////////
-#if defined(__arm__)
-/**
- * (ARMv7) Full memory barriar.
- *
- * None of GCC 4.6/4.8 or clang 3.3/3.4 have a builtin intrinsic for ARM's ldrex/strex or dmb
- * instructions. This is a placeholder until supplied by the toolchain.
- */
-inline void __dmb()
-{
- // The linux kernel uses "dmb ish" to only sync with local monitor (arch/arm/include/asm/barrier.h):
- //#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
- //#define smp_mb() dmb(ish)
- __asm__ __volatile__ ("dmb ish" : : : "memory");
-}
-
-#define READ_WRITE_BARRIER {__dmb(); }
-#else
- #define READ_WRITE_BARRIER
-#endif
-//////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////
-// define macro to prevent memory reoderings of reads/and writes
-//TODO implement for all GCC platforms, else there are potential crashes with strict aliasing
- #define MEMORY_RW_REORDERING_BARRIER do { /*not implemented*/} while (0)
//default stack size for threads, currently only used on pthread platforms
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -325,7 +141,7 @@ inline void __dmb()
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
+ #undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(LINUX) || defined(APPLE)
#if !defined(_DEBUG)
#define SIMPLE_THREAD_STACK_SIZE_KB (256)
@@ -362,22 +178,6 @@ inline void __dmb()
#else
#define _HELP(x) ""
#endif
-//////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////
-// Globally Used Defines.
-//////////////////////////////////////////////////////////////////////////
-// CPU Types: _CPU_X86,_CPU_AMD64,_CPU_G5
-// Platform: WIN23,WIN64,LINUX32,LINUX64,MAC
-// CPU supported functionality: _CPU_SSE
-//////////////////////////////////////////////////////////////////////////
-
-
- #if defined(_MSC_VER)
- #define PREFAST_SUPPRESS_WARNING(W) __pragma(warning(suppress: W))
- #else
- #define PREFAST_SUPPRESS_WARNING(W)
- #endif
#ifdef _PREFAST_
# define PREFAST_ASSUME(cond) __analysis_assume(cond)
@@ -385,47 +185,21 @@ inline void __dmb()
# define PREFAST_ASSUME(cond)
#endif
-
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_9
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
- #if defined(WIN32) && !defined(WIN64)
- #include "Win32specific.h"
- #endif
-
- #if defined(WIN64)
- #include "Win64specific.h"
- #endif
-#endif
-
-#if defined(LINUX64) && !defined(ANDROID)
-#include "Linux64Specific.h"
-#endif
-
-#if defined(LINUX32) && !defined(ANDROID)
-#include "Linux32Specific.h"
-#endif
-
-#if defined(ANDROID)
-#include "AndroidSpecific.h"
-#endif
-
-
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_10
#include AZ_RESTRICTED_FILE(platform_h)
-#endif
-
-#if defined(MAC)
-#include "MacSpecific.h"
-#endif
-
-#if defined(IOS)
-#include "iOSSpecific.h"
+#else
+ #if defined(WIN64)
+ #include "Win64specific.h"
+ #elif defined(LINUX64)
+ #include "Linux64Specific.h"
+ #elif defined(MAC)
+ #include "MacSpecific.h"
+ #elif defined(ANDROID)
+ #include "AndroidSpecific.h"
+ #elif defined(IOS)
+ #include "iOSSpecific.h"
+ #endif
#endif
@@ -480,12 +254,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
#define DEPRECATED
#endif
-//////////////////////////////////////////////////////////////////////////
-// compile time error stuff
-//////////////////////////////////////////////////////////////////////////
-#undef STATIC_CHECK
-#define STATIC_CHECK(expr, msg) static_assert(expr, #msg)
-
// Assert dialog box macros
#include "CryAssert.h"
@@ -500,30 +268,8 @@ ILINE DestinationType alias_cast(SourceType pPtr)
// Platform dependent functions that emulate Win32 API.
// Mostly used only for debugging!
//////////////////////////////////////////////////////////////////////////
-void CryDebugBreak();
void CrySleep(unsigned int dwMilliseconds);
-void CryLowLatencySleep(unsigned int dwMilliseconds);
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType);
-short CryGetAsyncKeyState(int vKey);
-unsigned int CryGetFileAttributes(const char* lpFileName);
-
-inline void CryHeapCheck()
-{
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_11
- #include AZ_RESTRICTED_FILE(platform_h)
-#elif !defined(LINUX) && !defined(APPLE) // todo: this might be readded with later xdks?
-#if !defined(NDEBUG)
- int Result =
-#endif
- _heapchk();
- assert(Result != _HEAPBADBEGIN);
- assert(Result != _HEAPBADNODE);
- assert(Result != _HEAPBADPTR);
- assert(Result != _HEAPEMPTY);
- assert(Result == _HEAPOK);
-#endif
-}
//---------------------------------------------------------------------------
// Useful function to clean the structure.
@@ -554,77 +300,6 @@ inline D check_cast(S const& s)
return d;
}
-// Convert one type to another, asserting there is no conversion loss.
-// Usage: DestType dest; check_convert(dest, src);
-template
-inline D& check_convert(D& d, S const& s)
-{
- d = D(s);
- assert(S(d) == s);
- return d;
-}
-
-// Convert one type to another, asserting there is no conversion loss.
-// Usage: DestType dest; check_convert(dest) = src;
-template
-struct CheckConvert
-{
- CheckConvert(D& d)
- : dest(&d) {}
-
- template
- D& operator=(S const& s)
- {
- return check_convert(*dest, s);
- }
-
-protected:
- D* dest;
-};
-
-template
-inline CheckConvert check_convert(D& d)
-{
- return d;
-}
-
-//---------------------------------------------------------------------------
-// Use NoCopy as a base class to easily prevent copy init & assign for any class.
-struct NoCopy
-{
- NoCopy() {}
-private:
- NoCopy(const NoCopy&);
- NoCopy& operator =(const NoCopy&);
-};
-
-//---------------------------------------------------------------------------
-// ZeroInit: base class to zero the memory of the derived class before initialization, so local objects initialize the same as static.
-// Usage:
-// class MyClass: ZeroInit {...}
-// class MyChild: public MyClass, ZeroInit {...} // ZeroInit must be the last base class
-
-template
-struct ZeroInit
-{
-#if defined(__clang__) || defined(__GNUC__)
- bool __dummy; // Dummy var to create non-zero size, ensuring proper placement in TDerived
-#endif
-
- ZeroInit(bool bZero = true)
- {
- // Optional bool arg to selectively disable zeroing.
- if (bZero)
- {
- // Infer offset of this base class by static casting to derived class.
- // Zero only the additional memory of the derived class.
- TDerived* struct_end = static_cast(this) + 1;
- size_t memory_size = (char*)struct_end - (char*)this;
- memset(this, 0, memory_size);
- }
- }
-};
-
//---------------------------------------------------------------------------
// Quick const-manipulation macros
@@ -705,29 +380,19 @@ threadID CryGetCurrentThreadId();
#include "CryFixedString.h"
#endif
-// need this in a common header file and any other file would be too misleading
-enum ETriState
-{
- eTS_false,
- eTS_true,
- eTS_maybe
-};
-
- #ifdef __GNUC__
- #define NO_INLINE __attribute__ ((noinline))
-# define NO_INLINE_WEAK __attribute__ ((noinline)) __attribute__((weak)) // marks a function as no_inline, but also as weak to prevent multiple-defined errors
-
-# define __PACKED __attribute__ ((packed))
- #else
- #define NO_INLINE _declspec(noinline)
-# define NO_INLINE_WEAK _declspec(noinline) inline
-
-# define __PACKED
- #endif
+#ifdef __GNUC__
+ #define NO_INLINE __attribute__ ((noinline))
+ #define NO_INLINE_WEAK __attribute__ ((noinline)) __attribute__((weak)) // marks a function as no_inline, but also as weak to prevent multiple-defined errors
+ #define __PACKED __attribute__ ((packed))
+#else
+ #define NO_INLINE _declspec(noinline)
+ #define NO_INLINE_WEAK _declspec(noinline) inline
+ #define __PACKED
+#endif
// Fallback for Alignment macro of GCC/CLANG (must be after the class definition)
#if !defined(_ALIGN)
- #define _ALIGN(num) AZ_POP_DISABLE_WARNING
+ #define _ALIGN(num) AZ_POP_DISABLE_WARNING
#endif
// Fallback for Alignment macro of MSVC (must be before the class definition)
@@ -735,60 +400,13 @@ enum ETriState
#define _MS_ALIGN(num) AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option")
#endif
-#if defined(WIN32) || defined(WIN64)
-extern "C" {
-__declspec(dllimport) unsigned long __stdcall TlsAlloc();
-__declspec(dllimport) void* __stdcall TlsGetValue(unsigned long dwTlsIndex);
-__declspec(dllimport) int __stdcall TlsSetValue(unsigned long dwTlsIndex, void* lpTlsValue);
-}
-
- #define TLS_DECLARE(type, var) extern int var##idx;
- #define TLS_DEFINE(type, var) \
- int var##idx; \
- struct Init##var { \
- Init##var() { var##idx = TlsAlloc(); } \
- }; \
- Init##var g_init##var;
- #define TLS_DEFINE_DEFAULT_VALUE(type, var, value) \
- int var##idx; \
- struct Init##var { \
- Init##var() { var##idx = TlsAlloc(); TlsSetValue(var##idx, reinterpret_cast(value)); } \
- }; \
- Init##var g_init##var;
- #define TLS_GET(type, var) (type)TlsGetValue(var##idx)
- #define TLS_SET(var, val) TlsSetValue(var##idx, reinterpret_cast(val))
-#elif defined(USE_PTHREAD_TLS)
- #define TLS_DECLARE(_TYPE, _VAR) extern SCryPthreadTLS<_TYPE> _VAR##TLSKey;
- #define TLS_DEFINE(_TYPE, _VAR) SCryPthreadTLS<_TYPE> _VAR##TLSKey;
- #define TLS_DEFINE_DEFAULT_VALUE(_TYPE, _VAR, _DEFAULT) SCryPthreadTLS<_TYPE> _VAR##TLSKey = _DEFAULT;
- #define TLS_GET(_TYPE, _VAR) _VAR##TLSKey.Get()
- #define TLS_SET(_VAR, _VALUE) _VAR##TLSKey.Set(_VALUE)
-#elif defined(THREADLOCAL)
- #define TLS_DECLARE(type, var) extern THREADLOCAL type var;
-#if defined(LINUX) || defined(MAC)
- #define TLS_DEFINE(type, var) THREADLOCAL type var = 0;
-#else
- #define TLS_DEFINE(type, var) THREADLOCAL type var;
-#endif // defined(LINUX) || defined(MAC)
- #define TLS_DEFINE_DEFAULT_VALUE(type, var, value) THREADLOCAL type var = value;
- #define TLS_GET(type, var) (var)
- #define TLS_SET(var, val) (var = (val))
-#else // defined(THREADLOCAL)
- #error "There's no support for thread local storage"
-#endif
-
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_13
#include AZ_RESTRICTED_FILE(platform_h)
#elif !defined(LINUX) && !defined(APPLE)
-typedef int socklen_t;
+ typedef int socklen_t;
#endif
-
-// Include MultiThreading support.
-#include "CryThread.h"
-#include "MultiThread.h"
-
// In RELEASE disable printf and fprintf
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -797,19 +415,4 @@ typedef int socklen_t;
#endif
#endif
-#define _STRINGIFY(x) #x
-#define STRINGIFY(x) _STRINGIFY(x)
-
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_15
- #include AZ_RESTRICTED_FILE(platform_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#elif defined(WIN32) || defined(WIN64)
- #define MESSAGE(msg) message(__FILE__ "(" STRINGIFY(__LINE__) "): " msg)
-#else
- #define MESSAGE(msg)
-#endif
-
void InitRootDir(char szExeFileName[] = nullptr, uint nExeSize = 0, char szExeRootName[] = nullptr, uint nRootSize = 0);
diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp
index a677ba30b6..a919b9a002 100644
--- a/Code/Legacy/CryCommon/platform_impl.cpp
+++ b/Code/Legacy/CryCommon/platform_impl.cpp
@@ -204,17 +204,6 @@ void __stl_debug_message(const char* format_str, ...)
#include "CryAssert_impl.h"
-//////////////////////////////////////////////////////////////////////////
-void CryDebugBreak()
-{
-#if defined(WIN32) && !defined(RELEASE)
- if (IsDebuggerPresent())
-#endif
- {
- DebugBreak();
- }
-}
-
//////////////////////////////////////////////////////////////////////////
void CrySleep(unsigned int dwMilliseconds)
{
@@ -222,21 +211,6 @@ void CrySleep(unsigned int dwMilliseconds)
Sleep(dwMilliseconds);
}
-//////////////////////////////////////////////////////////////////////////
-void CryLowLatencySleep(unsigned int dwMilliseconds)
-{
- AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System);
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYLOWLATENCYSLEEP
- #include AZ_RESTRICTED_FILE(platform_impl_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
- CrySleep(dwMilliseconds);
-#endif
-}
-
//////////////////////////////////////////////////////////////////////////
int CryMessageBox([[maybe_unused]] const char* lpText, [[maybe_unused]] const char* lpCaption, [[maybe_unused]] unsigned int uType)
{
@@ -302,16 +276,6 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[ma
}
}
-//////////////////////////////////////////////////////////////////////////
-short CryGetAsyncKeyState([[maybe_unused]] int vKey)
-{
-#ifdef WIN32
- return GetAsyncKeyState(vKey);
-#else
- return 0;
-#endif
-}
-
//////////////////////////////////////////////////////////////////////////
LONG CryInterlockedIncrement(int volatile* lpAddend)
{
@@ -417,23 +381,6 @@ void CryLeaveCriticalSection(void* cs)
LeaveCriticalSection((CRITICAL_SECTION*)cs);
}
-//////////////////////////////////////////////////////////////////////////
-uint32 CryGetFileAttributes(const char* lpFileName)
-{
- WIN32_FILE_ATTRIBUTE_DATA data;
- BOOL res;
-#if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYGETFILEATTRIBUTES
- #include AZ_RESTRICTED_FILE(platform_impl_h)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
- res = GetFileAttributesEx(lpFileName, GetFileExInfoStandard, &data);
-#endif
- return res ? data.dwFileAttributes : -1;
-}
-
//////////////////////////////////////////////////////////////////////////
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
{
diff --git a/Code/Legacy/CryCommon/smartptr.h b/Code/Legacy/CryCommon/smartptr.h
index 246e18d541..6953348d47 100644
--- a/Code/Legacy/CryCommon/smartptr.h
+++ b/Code/Legacy/CryCommon/smartptr.h
@@ -13,6 +13,7 @@
#include
#include
+#include
void CryFatalError(const char*, ...) PRINTF_PARAMS(1, 2);
#if defined(APPLE)
@@ -171,13 +172,13 @@ public:
void AddRef()
{
- CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
+ AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
++m_nRefCounter;
}
void Release()
{
- CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
+ AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
if (--m_nRefCounter == 0)
{
delete static_cast(this);
@@ -215,13 +216,13 @@ public:
void AddRef()
{
- CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
+ AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
++m_nRefCounter;
}
void Release()
{
- CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
+ AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
if (--m_nRefCounter == 0)
{
delete this;
@@ -272,13 +273,13 @@ public:
void AddRef()
{
- CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
+ AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
++m_nRefCounter;
}
void Release()
{
- CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
+ AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
if (--m_nRefCounter == 0)
{
assert(m_pDeleteFnc);
diff --git a/Code/Legacy/CrySystem/IDebugCallStack.cpp b/Code/Legacy/CrySystem/IDebugCallStack.cpp
index 4ca481be88..85b9ff4b79 100644
--- a/Code/Legacy/CrySystem/IDebugCallStack.cpp
+++ b/Code/Legacy/CrySystem/IDebugCallStack.cpp
@@ -227,7 +227,7 @@ void IDebugCallStack::FatalError(const char* description)
#if defined(WIN32) || !defined(_RELEASE)
int* p = 0x0;
- PREFAST_SUPPRESS_WARNING(6011) * p = 1; // we're intentionally crashing here
+ *p = 1; // we're intentionally crashing here
#endif
}
diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp
index cce3cf4aec..8ea653fb81 100644
--- a/Code/Legacy/CrySystem/SystemInit.cpp
+++ b/Code/Legacy/CrySystem/SystemInit.cpp
@@ -252,7 +252,7 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs)
case 1:
{
int* p = 0;
- PREFAST_SUPPRESS_WARNING(6011) * p = 0xABCD;
+ *p = 0xABCD;
}
break;
case 2:
diff --git a/Code/Legacy/CrySystem/SystemWin32.cpp b/Code/Legacy/CrySystem/SystemWin32.cpp
index 2cc41adc08..1f5dc7d0b0 100644
--- a/Code/Legacy/CrySystem/SystemWin32.cpp
+++ b/Code/Legacy/CrySystem/SystemWin32.cpp
@@ -355,32 +355,25 @@ void CSystem::FatalError(const char* format, ...)
IDebugCallStack::instance()->FatalError(szBuffer);
#endif
- CryDebugBreak();
-
// app can not continue
+ AZ::Debug::Trace::Break();
+
#ifdef _DEBUG
+ #if defined(WIN32) || defined(WIN64)
+ _flushall();
+ // on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
+ TerminateProcess(GetCurrentProcess(), 1);
+ #endif
-#if defined(WIN32) && !defined(WIN64)
- DEBUG_BREAK;
-#endif
-
-#else
-
-#if defined(WIN32) || defined(WIN64)
- _flushall();
- // on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
- TerminateProcess(GetCurrentProcess(), 1);
-#endif
-
-#if defined(AZ_RESTRICTED_PLATFORM)
-#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
-#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
-#endif
-#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
-#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
-#else
- _exit(1);
-#endif
+ #if defined(AZ_RESTRICTED_PLATFORM)
+ #define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
+ #include AZ_RESTRICTED_FILE(SystemWin32_cpp)
+ #endif
+ #if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
+ #undef AZ_RESTRICTED_SECTION_IMPLEMENTED
+ #else
+ _exit(1);
+ #endif
#endif
}
diff --git a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp
index a82e78c08c..3280c8daa9 100644
--- a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp
+++ b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp
@@ -26,7 +26,7 @@
if (count > 0) \
{ \
const size_t memSize = count * sizeof(IViewSystemListener*); \
- PREFAST_SUPPRESS_WARNING(6255) IViewSystemListener * *pArray = (IViewSystemListener**) alloca(memSize); \
+ IViewSystemListener* *pArray = (IViewSystemListener**) alloca(memSize); \
memcpy(pArray, &*m_listeners.begin(), memSize); \
while (count--) \
{ \
diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp
index 0493a64ca8..4fec4d3fd9 100644
--- a/Code/Legacy/CrySystem/XML/xml.cpp
+++ b/Code/Legacy/CrySystem/XML/xml.cpp
@@ -1390,7 +1390,7 @@ protected:
{
((XmlParserImp*)userData)->onEndElement(name);
}
- static void characterData(void* userData, const char* s, int len) PREFAST_SUPPRESS_WARNING(6262)
+ static void characterData(void* userData, const char* s, int len)
{
char str[32700];
if (len > sizeof(str) - 1)
diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp
index d61090f79d..c28c13ba94 100644
--- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp
+++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp
@@ -26,12 +26,12 @@
//////////////////////////////////////////////////////////////////////////
// Serialization for anim nodes & param types
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(eUiAnimNodeType_ ## name) == g_animNodeEnumToStringMap.end()); \
- g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = STRINGIFY(name); \
- g_animNodeStringToEnumMap[string(STRINGIFY(name))] = eUiAnimNodeType_ ## name;
+ g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = AZ_STRINGIZE(name); \
+ g_animNodeStringToEnumMap[string(AZ_STRINGIZE(name))] = eUiAnimNodeType_ ## name;
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(eUiAnimParamType_ ## name) == g_animParamEnumToStringMap.end()); \
- g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = STRINGIFY(name); \
- g_animParamStringToEnumMap[string(STRINGIFY(name))] = eUiAnimParamType_ ## name;
+ g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = AZ_STRINGIZE(name); \
+ g_animParamStringToEnumMap[string(AZ_STRINGIZE(name))] = eUiAnimParamType_ ## name;
namespace
{
diff --git a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp
index b781dd6c82..589a084426 100644
--- a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp
+++ b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp
@@ -74,12 +74,12 @@ static SMovieSequenceAutoComplete s_movieSequenceAutoComplete;
//////////////////////////////////////////////////////////////////////////
// Serialization for anim nodes & param types
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(AnimNodeType::name) == g_animNodeEnumToStringMap.end()); \
- g_animNodeEnumToStringMap[AnimNodeType::name] = STRINGIFY(name); \
- g_animNodeStringToEnumMap[string(STRINGIFY(name))] = AnimNodeType::name;
+ g_animNodeEnumToStringMap[AnimNodeType::name] = AZ_STRINGIZE(name); \
+ g_animNodeStringToEnumMap[string(AZ_STRINGIZE(name))] = AnimNodeType::name;
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(AnimParamType::name) == g_animParamEnumToStringMap.end()); \
- g_animParamEnumToStringMap[AnimParamType::name] = STRINGIFY(name); \
- g_animParamStringToEnumMap[string(STRINGIFY(name))] = AnimParamType::name;
+ g_animParamEnumToStringMap[AnimParamType::name] = AZ_STRINGIZE(name); \
+ g_animParamStringToEnumMap[string(AZ_STRINGIZE(name))] = AnimParamType::name;
namespace
{
From 360d0bdd0bde6fe56b1fdccc9bf017e221f3fd98 Mon Sep 17 00:00:00 2001
From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
Date: Fri, 6 Aug 2021 16:42:38 -0700
Subject: [PATCH 16/28] removing more unused stuff
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
---
.../GridMate/Carrier/SocketDriver.cpp | 42 +++++-----
Code/Legacy/CryCommon/AndroidSpecific.h | 13 ---
Code/Legacy/CryCommon/AppleSpecific.h | 67 ---------------
Code/Legacy/CryCommon/BaseTypes.h | 47 +++++------
Code/Legacy/CryCommon/BitFiddling.h | 40 ---------
Code/Legacy/CryCommon/CompileTimeAssert.h | 56 -------------
Code/Legacy/CryCommon/CryArray.h | 2 +-
Code/Legacy/CryCommon/CryCustomTypes.h | 4 +-
Code/Legacy/CryCommon/CryHeaders.h | 2 +-
Code/Legacy/CryCommon/CryLibrary.h | 1 -
Code/Legacy/CryCommon/CryRandomInternal.h | 27 +++---
Code/Legacy/CryCommon/CryWindows.h | 19 -----
Code/Legacy/CryCommon/IMaterial.h | 2 +-
Code/Legacy/CryCommon/ISystem.h | 83 +++++++++---------
Code/Legacy/CryCommon/ITexture.h | 4 +-
Code/Legacy/CryCommon/Linux32Specific.h | 8 --
Code/Legacy/CryCommon/Linux64Specific.h | 8 --
Code/Legacy/CryCommon/LinuxSpecific.h | 84 -------------------
Code/Legacy/CryCommon/Linux_Win32Wrapper.h | 2 -
Code/Legacy/CryCommon/MacSpecific.h | 34 --------
Code/Legacy/CryCommon/Options.h | 2 +-
Code/Legacy/CryCommon/StringUtils.h | 4 +-
Code/Legacy/CryCommon/UnicodeBinding.h | 42 +++++-----
Code/Legacy/CryCommon/UnicodeEncoding.h | 4 +-
Code/Legacy/CryCommon/UnicodeFunctions.h | 4 +-
Code/Legacy/CryCommon/UnicodeIterator.h | 4 +-
Code/Legacy/CryCommon/Win32specific.h | 8 --
Code/Legacy/CryCommon/Win64specific.h | 8 --
Code/Legacy/CryCommon/crycommon_files.cmake | 2 -
Code/Legacy/CryCommon/iOSSpecific.h | 2 -
Code/Legacy/CryCommon/platform.h | 1 -
Code/Legacy/CryCommon/stridedptr.h | 4 +-
Code/Legacy/CrySystem/CrySystem_precompiled.h | 2 +-
.../CrySystem/LevelSystem/LevelSystem.cpp | 4 -
Code/Legacy/CrySystem/XML/XMLBinaryReader.cpp | 2 +-
Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp | 2 +-
36 files changed, 139 insertions(+), 501 deletions(-)
delete mode 100644 Code/Legacy/CryCommon/CompileTimeAssert.h
delete mode 100644 Code/Legacy/CryCommon/CryWindows.h
diff --git a/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp b/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp
index b75de6f383..a72c6b54f6 100644
--- a/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp
+++ b/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp
@@ -1528,7 +1528,7 @@ namespace GridMate
if (0 != WSAIoctl( m_socket, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, &functionTableId,
sizeof(GUID), (void**)&m_RIO_FN_TABLE, sizeof(m_RIO_FN_TABLE), &dwBytes, 0, 0))
{
- AZ_Error("GridMate", false, "Could not initialize RIO: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not initialize RIO: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
else
@@ -1543,13 +1543,13 @@ namespace GridMate
if ((m_events[WakeupOnSend] = WSACreateEvent()) == WSA_INVALID_EVENT)
{
- AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
if ((m_events[ReceiveEvent] = WSACreateEvent()) == WSA_INVALID_EVENT)
{
- AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
RIO_NOTIFICATION_COMPLETION typeRecv;
@@ -1559,13 +1559,13 @@ namespace GridMate
m_RIORecvQueue = m_RIO_FN_TABLE.RIOCreateCompletionQueue(maxOutstandingReceive, &typeRecv);
if (m_RIORecvQueue == RIO_INVALID_CQ)
{
- AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
if ((m_events[SendEvent] = WSACreateEvent()) == WSA_INVALID_EVENT)
{
- AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
RIO_NOTIFICATION_COMPLETION typeSend;
@@ -1575,7 +1575,7 @@ namespace GridMate
m_RIOSendQueue = m_RIO_FN_TABLE.RIOCreateCompletionQueue(maxOutstandingSend, &typeSend);
if (m_RIOSendQueue == RIO_INVALID_CQ)
{
- AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
@@ -1583,7 +1583,7 @@ namespace GridMate
maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, m_RIORecvQueue, m_RIOSendQueue, pContext);
if (m_requestQueue == RIO_INVALID_RQ)
{
- AZ_Error("GridMate", m_requestQueue != NULL, "Could not RIOCreateRequestQueue: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", m_requestQueue != NULL, "Could not RIOCreateRequestQueue: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
@@ -1596,24 +1596,24 @@ namespace GridMate
//Setup Recv raw buffer and RIO record
if (nullptr == (m_rawRecvBuffer = AllocRIOBuffer(bufferSize, m_RIORecvBufferCount, &recvAllocated)))
{
- AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
if (RIO_INVALID_BUFFERID == (recvBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawRecvBuffer, bufferSize * m_RIORecvBufferCount)))
{
- AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
//Setup Recv address raw buffer and RIO record
if (nullptr == (m_rawRecvAddressBuffer = AllocRIOBuffer(sizeof(SOCKADDR_INET), m_RIORecvBufferCount, &recvAddrsAllocated)))
{
- AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
if (RIO_INVALID_BUFFERID == (recvAddressBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawRecvAddressBuffer, sizeof(SOCKADDR_INET) * m_RIORecvBufferCount)))
{
- AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
@@ -1640,7 +1640,7 @@ namespace GridMate
//Start Receive Handler
if (false == m_RIO_FN_TABLE.RIOReceiveEx(m_requestQueue, &m_RIORecvBuffer[i], 1, NULL, &m_RIORecvAddressBuffer[i], NULL, NULL, 0, pBuffer))
{
- AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
}
@@ -1650,25 +1650,25 @@ namespace GridMate
//setup send raw buffer and RIO record
if (nullptr == (m_rawSendBuffer = AllocRIOBuffer(bufferSize, m_RIOSendBufferCount, &sendAllocated)))
{
- AZ_Error("GridMate", false, "Could not allocate buffer: %u", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not allocate buffer: %u", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
if (RIO_INVALID_BUFFERID == (sendBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawSendBuffer, m_RIOSendBufferCount * bufferSize)))
{
- AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
//setup send address raw buffer and RIO record
if (nullptr == (m_rawSendAddressBuffer = AllocRIOBuffer(sizeof(SOCKADDR_INET), m_RIOSendBufferCount, &sendAddrsAllocated)))
{
- AZ_Error("GridMate", false, "Could not allocate send address buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not allocate send address buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
if (RIO_INVALID_BUFFERID == (sendAddressBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawSendAddressBuffer, m_RIOSendBufferCount * sizeof(SOCKADDR_INET))))
{
- AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
return EC_SOCKET_CREATE;
}
@@ -1726,7 +1726,7 @@ namespace GridMate
if (!m_RIO_FN_TABLE.RIOSendEx(m_requestQueue, &m_RIOSendBuffer[m_workerNextSendBuffer],
bufferCount, NULL, &m_RIOSendAddressBuffer[m_workerNextSendBuffer], NULL, NULL, 0, 0))
{
- const DWORD lastError = ::WSAGetLastError();
+ const DWORD lastError = GridMate::Platform::GetSocketError();
if (lastError == WSAENOBUFS)
{
continue; //spin until free
@@ -1836,7 +1836,7 @@ namespace GridMate
if (false == m_RIO_FN_TABLE.RIOReceiveEx(m_requestQueue, &m_RIORecvBuffer[m_RIONextRecvBuffer],
bufferCount, NULL, &m_RIORecvAddressBuffer[m_RIONextRecvBuffer], NULL, NULL, 0, 0))
{
- AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", ::WSAGetLastError());
+ AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", GridMate::Platform::GetSocketError());
}
if (recvd)
@@ -1867,7 +1867,7 @@ namespace GridMate
{
if (!WSAResetEvent(m_events[Index - WSA_WAIT_EVENT_0]))
{
- AZ_Assert(false, "WSAResetEvent failed with error = %d\n", ::WSAGetLastError());
+ AZ_Assert(false, "WSAResetEvent failed with error = %d\n", GridMate::Platform::GetSocketError());
}
};
@@ -1926,7 +1926,7 @@ namespace GridMate
}
else if (isFailed(Index))
{
- AZ_Assert(false, "WSAWaitForMultipleEvents failed with error = %d\n", ::WSAGetLastError());
+ AZ_Assert(false, "WSAWaitForMultipleEvents failed with error = %d\n", GridMate::Platform::GetSocketError());
return false;
}
else
@@ -1945,7 +1945,7 @@ namespace GridMate
{
if (!SetEvent(m_events[WakeupOnSend])) //Wake thread
{
- AZ_Assert(false, "SetEvent failed with error = %d\n", ::WSAGetLastError());
+ AZ_Assert(false, "SetEvent failed with error = %d\n", GridMate::Platform::GetSocketError());
}
}
diff --git a/Code/Legacy/CryCommon/AndroidSpecific.h b/Code/Legacy/CryCommon/AndroidSpecific.h
index a0f57553ca..cf4359ba47 100644
--- a/Code/Legacy/CryCommon/AndroidSpecific.h
+++ b/Code/Legacy/CryCommon/AndroidSpecific.h
@@ -30,15 +30,6 @@
#define MOBILE
#endif
-// Force all allocations to be aligned to TARGET_DEFAULT_ALIGN.
-// This is because malloc on Android 32 bit returns memory that is not aligned
-// to what some structs/classes need.
-#define CRY_FORCE_MALLOC_NEW_ALIGN
-
-#define RC_EXECUTABLE "rc"
-#define USE_CRT 1
-#define SIZEOF_PTR 4
-
//////////////////////////////////////////////////////////////////////////
// Standard includes.
//////////////////////////////////////////////////////////////////////////
@@ -120,10 +111,6 @@ typedef unsigned char byte;
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
- static type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
- const type __attribute__ ((aligned(alignment))) name;
#include "LinuxSpecific.h"
// these functions do not exist int the wchar.h header
diff --git a/Code/Legacy/CryCommon/AppleSpecific.h b/Code/Legacy/CryCommon/AppleSpecific.h
index ed76de8986..87aea0fbb5 100644
--- a/Code/Legacy/CryCommon/AppleSpecific.h
+++ b/Code/Legacy/CryCommon/AppleSpecific.h
@@ -17,9 +17,6 @@
#pragma diagnostic ignore "-W#pragma-messages"
#endif
-
-#define RC_EXECUTABLE "rc"
-
//////////////////////////////////////////////////////////////////////////
// Standard includes.
//////////////////////////////////////////////////////////////////////////
@@ -260,10 +257,6 @@ typedef uint64 __uint64;
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
- static type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
- const type __attribute__ ((aligned(alignment))) name;
#define BST_UNCHECKED 0x0000
@@ -296,17 +289,6 @@ enum
IDCONTINUE = 11
};
-#define ES_MULTILINE 0x0004L
-#define ES_AUTOVSCROLL 0x0040L
-#define ES_AUTOHSCROLL 0x0080L
-#define ES_WANTRETURN 0x1000L
-
-#define LB_ERR (-1)
-
-#define LB_ADDSTRING 0x0180
-#define LB_GETCOUNT 0x018B
-#define LB_SETTOPINDEX 0x0197
-
#define MB_OK 0x00000000L
#define MB_OKCANCEL 0x00000001L
#define MB_ABORTRETRYIGNORE 0x00000002L
@@ -326,22 +308,16 @@ enum
#define MB_APPLMODAL 0x00000000L
-#define MF_STRING 0x00000000L
-
#define MK_LBUTTON 0x0001
#define MK_RBUTTON 0x0002
#define MK_SHIFT 0x0004
#define MK_CONTROL 0x0008
#define MK_MBUTTON 0x0010
-#define MK_ALT ( 0x20 )
-
#define SM_MOUSEPRESENT 0x00000000L
#define SM_CMOUSEBUTTONS 43
-#define USER_TIMER_MINIMUM 0x0000000A
-
#define VK_TAB 0x09
#define VK_SHIFT 0x10
#define VK_MENU 0x12
@@ -349,11 +325,6 @@ enum
#define VK_SPACE 0x20
#define VK_DELETE 0x2E
-#define VK_NUMPAD1 0x61
-#define VK_NUMPAD2 0x62
-#define VK_NUMPAD3 0x63
-#define VK_NUMPAD4 0x64
-
#define VK_OEM_COMMA 0xBC // ',' any country
#define VK_OEM_PERIOD 0xBE // '.' any country
#define VK_OEM_3 0xC0 // '`~' for US
@@ -496,36 +467,6 @@ typedef HANDLE HMENU;
#endif //__cplusplus
-inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength)
-{
- char path[PATH_MAX];
-
- if (realpath(relPath, path) == NULL)
- {
- return NULL;
- }
- const size_t len = std::min(strlen(path), maxLength - 1);
- memcpy(absPath, path, len);
- absPath[len] = 0;
- return absPath;
-}
-
-typedef union _LARGE_INTEGER
-{
- struct
- {
- DWORD LowPart;
- LONG HighPart;
- };
- struct
- {
- DWORD LowPart;
- LONG HighPart;
- } u;
-
- long long QuadPart;
-} LARGE_INTEGER;
-
extern bool QueryPerformanceCounter(LARGE_INTEGER*);
extern bool QueryPerformanceFrequency(LARGE_INTEGER* frequency);
@@ -566,14 +507,6 @@ inline int closesocket(int s)
return ::close(s);
}
-inline int WSAGetLastError()
-{
- return errno;
-}
-
-//we take the definition of the pthread_t type directly from the pthread file
-#define THREADID_NULL 0
-
template
char (*RtlpNumberOf( T (&)[N] ))[N];
diff --git a/Code/Legacy/CryCommon/BaseTypes.h b/Code/Legacy/CryCommon/BaseTypes.h
index e8b6ae8ab7..0c588184a5 100644
--- a/Code/Legacy/CryCommon/BaseTypes.h
+++ b/Code/Legacy/CryCommon/BaseTypes.h
@@ -11,12 +11,9 @@
#define CRYINCLUDE_CRYCOMMON_BASETYPES_H
#pragma once
-#include "CompileTimeAssert.h"
-
-
-COMPILE_TIME_ASSERT(sizeof(char) == 1);
-COMPILE_TIME_ASSERT(sizeof(float) == 4);
-COMPILE_TIME_ASSERT(sizeof(int) >= 4);
+static_assert(sizeof(char) == 1);
+static_assert(sizeof(float) == 4);
+static_assert(sizeof(int) >= 4);
typedef unsigned char uchar;
@@ -36,35 +33,35 @@ typedef signed long slong;
typedef unsigned long long ulonglong;
typedef signed long long slonglong;
-COMPILE_TIME_ASSERT(sizeof(uchar) == sizeof(schar));
-COMPILE_TIME_ASSERT(sizeof(ushort) == sizeof(sshort));
-COMPILE_TIME_ASSERT(sizeof(uint) == sizeof(sint));
-COMPILE_TIME_ASSERT(sizeof(ulong) == sizeof(slong));
-COMPILE_TIME_ASSERT(sizeof(ulonglong) == sizeof(slonglong));
+static_assert(sizeof(uchar) == sizeof(schar));
+static_assert(sizeof(ushort) == sizeof(sshort));
+static_assert(sizeof(uint) == sizeof(sint));
+static_assert(sizeof(ulong) == sizeof(slong));
+static_assert(sizeof(ulonglong) == sizeof(slonglong));
-COMPILE_TIME_ASSERT(sizeof(uchar) <= sizeof(ushort));
-COMPILE_TIME_ASSERT(sizeof(ushort) <= sizeof(uint));
-COMPILE_TIME_ASSERT(sizeof(uint) <= sizeof(ulong));
-COMPILE_TIME_ASSERT(sizeof(ulong) <= sizeof(ulonglong));
+static_assert(sizeof(uchar) <= sizeof(ushort));
+static_assert(sizeof(ushort) <= sizeof(uint));
+static_assert(sizeof(uint) <= sizeof(ulong));
+static_assert(sizeof(ulong) <= sizeof(ulonglong));
typedef schar int8;
typedef schar sint8;
typedef uchar uint8;
-COMPILE_TIME_ASSERT(sizeof(uint8) == 1);
-COMPILE_TIME_ASSERT(sizeof(sint8) == 1);
+static_assert(sizeof(uint8) == 1);
+static_assert(sizeof(sint8) == 1);
typedef sshort int16;
typedef sshort sint16;
typedef ushort uint16;
-COMPILE_TIME_ASSERT(sizeof(uint16) == 2);
-COMPILE_TIME_ASSERT(sizeof(sint16) == 2);
+static_assert(sizeof(uint16) == 2);
+static_assert(sizeof(sint16) == 2);
typedef sint int32;
typedef sint sint32;
typedef uint uint32;
-COMPILE_TIME_ASSERT(sizeof(uint32) == 4);
-COMPILE_TIME_ASSERT(sizeof(sint32) == 4);
+static_assert(sizeof(uint32) == 4);
+static_assert(sizeof(sint32) == 4);
typedef slonglong int64;
@@ -72,14 +69,14 @@ typedef slonglong int64;
#define O3DE_INT64_DEFINED
typedef slonglong sint64;
typedef ulonglong uint64;
-COMPILE_TIME_ASSERT(sizeof(uint64) == 8);
-COMPILE_TIME_ASSERT(sizeof(sint64) == 8);
+static_assert(sizeof(uint64) == 8);
+static_assert(sizeof(sint64) == 8);
#endif
typedef float f32;
typedef double f64;
-COMPILE_TIME_ASSERT(sizeof(f32) == 4);
-COMPILE_TIME_ASSERT(sizeof(f64) == 8);
+static_assert(sizeof(f32) == 4);
+static_assert(sizeof(f64) == 8);
#endif // CRYINCLUDE_CRYCOMMON_BASETYPES_H
diff --git a/Code/Legacy/CryCommon/BitFiddling.h b/Code/Legacy/CryCommon/BitFiddling.h
index 342aad9a82..36173c5e53 100644
--- a/Code/Legacy/CryCommon/BitFiddling.h
+++ b/Code/Legacy/CryCommon/BitFiddling.h
@@ -12,7 +12,6 @@
#pragma once
-#include "CompileTimeAssert.h"
#include
// Section dictionary
@@ -188,45 +187,6 @@ ILINE int32 Isel32(int32 v, int32 alt)
return ((static_cast(v) >> 31) & alt) | ((static_cast(~v) >> 31) & v);
}
-template
-struct CompileTimeIntegerLog2
-{
- static const uint32 result = 1 + CompileTimeIntegerLog2<(ILOG >> 1)>::result;
-};
-template <>
-struct CompileTimeIntegerLog2<1>
-{
- static const uint32 result = 0;
-};
-template <>
-struct CompileTimeIntegerLog2<0>; // keep it undefined, we cannot represent "minus infinity" result
-
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<1>::result == 0);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<2>::result == 1);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<3>::result == 1);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<4>::result == 2);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<5>::result == 2);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<255>::result == 7);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<256>::result == 8);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<257>::result == 8);
-
-template
-struct CompileTimeIntegerLog2_RoundUp
-{
- static const uint32 result = CompileTimeIntegerLog2::result + ((ILOG & (ILOG - 1)) != 0);
-};
-template <>
-struct CompileTimeIntegerLog2_RoundUp<0>; // we can return 0, but let's keep it undefined (same as CompileTimeIntegerLog2<0>)
-
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<1>::result == 0);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<2>::result == 1);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<3>::result == 2);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<4>::result == 2);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<5>::result == 3);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<255>::result == 8);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<256>::result == 8);
-COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<257>::result == 9);
-
// Character-to-bitfield mapping
inline uint32 AlphaBit(char c)
diff --git a/Code/Legacy/CryCommon/CompileTimeAssert.h b/Code/Legacy/CryCommon/CompileTimeAssert.h
deleted file mode 100644
index 80a2ecf6bf..0000000000
--- a/Code/Legacy/CryCommon/CompileTimeAssert.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-// Inspired by the Boost library's BOOST_STATIC_ASSERT(),
-// see http://www.boost.org/doc/libs/1_49_0/doc/html/boost_staticassert/how.html
-// or http://www.boost.org/libs/static_assert
-
-#ifndef CRYINCLUDE_CRYCOMMON_COMPILETIMEASSERT_H
-#define CRYINCLUDE_CRYCOMMON_COMPILETIMEASSERT_H
-#pragma once
-
-#if defined(__cplusplus)
-/*
-template
-struct COMPILE_TIME_ASSERT_FAIL;
-
-template <>
-struct COMPILE_TIME_ASSERT_FAIL
-{
-};
-
-template
-struct COMPILE_TIME_ASSERT_TEST
-{
- enum { dummy = i };
-};
-
-#define COMPILE_TIME_ASSERT_BUILD_NAME2(x, y) x##y
-#define COMPILE_TIME_ASSERT_BUILD_NAME1(x, y) COMPILE_TIME_ASSERT_BUILD_NAME2(x, y)
-#define COMPILE_TIME_ASSERT_BUILD_NAME(x, y) COMPILE_TIME_ASSERT_BUILD_NAME1(x, y)
-
-#ifndef __RECODE__
- #define COMPILE_TIME_ASSERT(expr) \
- typedef COMPILE_TIME_ASSERT_TEST)> \
- COMPILE_TIME_ASSERT_BUILD_NAME(compile_time_assert_test_, __LINE__)
- // note: for MS Visual Studio we could use __COUNTER__ instead of __LINE__
-#else
- #define COMPILE_TIME_ASSERT(expr)
-#endif // __RECODE__
-
-#else
-
-#define COMPILE_TIME_ASSERT(expr)
-*/
-#endif
-
-#define COMPILE_TIME_ASSERT_MSG(expr, msg) static_assert(expr, msg)
-#define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT_MSG(expr, "Compile Time Assert")
-
-
-#endif // CRYINCLUDE_CRYCOMMON_COMPILETIMEASSERT_H
diff --git a/Code/Legacy/CryCommon/CryArray.h b/Code/Legacy/CryCommon/CryArray.h
index 5b4684fdd2..ac935e5c45 100644
--- a/Code/Legacy/CryCommon/CryArray.h
+++ b/Code/Legacy/CryCommon/CryArray.h
@@ -771,7 +771,7 @@ namespace NArray
AP& allocator()
{
- COMPILE_TIME_ASSERT(sizeof(AP) == sizeof(A));
+ static_assert(sizeof(AP) == sizeof(A));
return *(AP*)this;
}
const AP& allocator() const
diff --git a/Code/Legacy/CryCommon/CryCustomTypes.h b/Code/Legacy/CryCommon/CryCustomTypes.h
index 9594f5a333..3b5b62e2f6 100644
--- a/Code/Legacy/CryCommon/CryCustomTypes.h
+++ b/Code/Legacy/CryCommon/CryCustomTypes.h
@@ -708,8 +708,8 @@ protected:
static inline S FromFloat(float fIn)
{
- COMPILE_TIME_ASSERT(sizeof(S) <= 4);
- COMPILE_TIME_ASSERT(nEXP_BITS > 0 && nEXP_BITS <= 8 && nEXP_BITS < sizeof(S) * 8 - 4);
+ static_assert(sizeof(S) <= 4);
+ static_assert(nEXP_BITS > 0 && nEXP_BITS <= 8 && nEXP_BITS < sizeof(S) * 8 - 4);
// Clamp to allowed range.
float fClamped = clamp_tpl(fIn * fROUNDER(), fMIN(), fMAX());
diff --git a/Code/Legacy/CryCommon/CryHeaders.h b/Code/Legacy/CryCommon/CryHeaders.h
index 6b4ea0ba3a..4d037b52d9 100644
--- a/Code/Legacy/CryCommon/CryHeaders.h
+++ b/Code/Legacy/CryCommon/CryHeaders.h
@@ -17,7 +17,7 @@
#ifdef MAX_SUB_MATERIALS
// This checks that the values are in sync in the different files.
-COMPILE_TIME_ASSERT(MAX_SUB_MATERIALS == 128);
+static_assert(MAX_SUB_MATERIALS == 128);
#else
#define MAX_SUB_MATERIALS 128
#endif
diff --git a/Code/Legacy/CryCommon/CryLibrary.h b/Code/Legacy/CryCommon/CryLibrary.h
index ca1ca5d067..787085af00 100644
--- a/Code/Legacy/CryCommon/CryLibrary.h
+++ b/Code/Legacy/CryCommon/CryLibrary.h
@@ -63,7 +63,6 @@ using DetachEnvironmentFunction = void(*)();
#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
- #include
HMODULE CryLoadLibrary(const char* libName);
diff --git a/Code/Legacy/CryCommon/CryRandomInternal.h b/Code/Legacy/CryCommon/CryRandomInternal.h
index 9499ba0774..ca74041189 100644
--- a/Code/Legacy/CryCommon/CryRandomInternal.h
+++ b/Code/Legacy/CryCommon/CryRandomInternal.h
@@ -13,7 +13,6 @@
#include // std::numeric_limits
#include // std::make_unsigned
#include "BaseTypes.h" // uint32, uint64
-#include "CompileTimeAssert.h"
#include "Cry_Vector2.h"
#include "Cry_Vector3.h"
#include "Cry_Vector4.h"
@@ -24,10 +23,10 @@ namespace CryRandom_Internal
template
struct BoundedRandomUint
{
- COMPILE_TIME_ASSERT(std::numeric_limits::is_integer);
- COMPILE_TIME_ASSERT(!std::numeric_limits::is_signed);
- COMPILE_TIME_ASSERT(sizeof(T) == size);
- COMPILE_TIME_ASSERT(sizeof(T) <= sizeof(uint32));
+ static_assert(std::numeric_limits::is_integer);
+ static_assert(!std::numeric_limits::is_signed);
+ static_assert(sizeof(T) == size);
+ static_assert(sizeof(T) <= sizeof(uint32));
inline static T Get(R& randomGenerator, const T maxValue)
{
@@ -41,9 +40,9 @@ namespace CryRandom_Internal
template
struct BoundedRandomUint
{
- COMPILE_TIME_ASSERT(std::numeric_limits::is_integer);
- COMPILE_TIME_ASSERT(!std::numeric_limits::is_signed);
- COMPILE_TIME_ASSERT(sizeof(T) == sizeof(uint64));
+ static_assert(std::numeric_limits::is_integer);
+ static_assert(!std::numeric_limits::is_signed);
+ static_assert(sizeof(T) == sizeof(uint64));
inline static T Get(R& randomGenerator, const T maxValue)
{
@@ -65,11 +64,11 @@ namespace CryRandom_Internal
template
struct BoundedRandom
{
- COMPILE_TIME_ASSERT(std::numeric_limits::is_integer);
+ static_assert(std::numeric_limits::is_integer);
typedef typename std::make_unsigned::type UT;
- COMPILE_TIME_ASSERT(sizeof(T) == sizeof(UT));
- COMPILE_TIME_ASSERT(std::numeric_limits::is_integer);
- COMPILE_TIME_ASSERT(!std::numeric_limits::is_signed);
+ static_assert(sizeof(T) == sizeof(UT));
+ static_assert(std::numeric_limits::is_integer);
+ static_assert(!std::numeric_limits::is_signed);
inline static T Get(R& randomGenerator, T minValue, T maxValue)
{
@@ -84,7 +83,7 @@ namespace CryRandom_Internal
template
struct BoundedRandom
{
- COMPILE_TIME_ASSERT(!std::numeric_limits::is_integer);
+ static_assert(!std::numeric_limits::is_integer);
inline static T Get(R& randomGenerator, const T minValue, const T maxValue)
{
@@ -139,7 +138,7 @@ namespace CryRandom_Internal
inline VT GetRandomUnitVector(R& randomGenerator)
{
typedef typename VT::value_type T;
- COMPILE_TIME_ASSERT(!std::numeric_limits::is_integer);
+ static_assert(!std::numeric_limits::is_integer);
VT res;
T lenSquared;
diff --git a/Code/Legacy/CryCommon/CryWindows.h b/Code/Legacy/CryCommon/CryWindows.h
deleted file mode 100644
index 77684384c6..0000000000
--- a/Code/Legacy/CryCommon/CryWindows.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : Specific header to handle Windows.h include
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_CRYWINDOWS_H
-#define CRYINCLUDE_CRYCOMMON_CRYWINDOWS_H
-#pragma once
-
-#include
-
-#endif // CRYINCLUDE_CRYCOMMON_CRYWINDOWS_H
diff --git a/Code/Legacy/CryCommon/IMaterial.h b/Code/Legacy/CryCommon/IMaterial.h
index f1967324d8..c5cd5712dc 100644
--- a/Code/Legacy/CryCommon/IMaterial.h
+++ b/Code/Legacy/CryCommon/IMaterial.h
@@ -41,7 +41,7 @@ struct IRenderMesh;
#ifdef MAX_SUB_MATERIALS
// This checks that the values are in sync in the different files.
-COMPILE_TIME_ASSERT(MAX_SUB_MATERIALS == 128);
+static_assert(MAX_SUB_MATERIALS == 128);
#else
#define MAX_SUB_MATERIALS 128
#endif
diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h
index 7cea690687..2820a2fd8d 100644
--- a/Code/Legacy/CryCommon/ISystem.h
+++ b/Code/Legacy/CryCommon/ISystem.h
@@ -24,7 +24,6 @@
#endif
#include "CryAssert.h"
-#include "CompileTimeAssert.h"
#include
@@ -1428,10 +1427,10 @@ namespace Detail
# define DeclareConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
# define DeclareStaticConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
-# define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
-# define DefineConstIntCVar(name, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
+# define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
+# define DefineConstIntCVar(name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
// DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
-# define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
+# define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
# define AllocateConstIntCVar(scope, name)
# define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, (#name), name ## Default); }
@@ -1543,33 +1542,33 @@ static void AssertConsoleExists(void)
#define ILLEGAL_DEV_FLAGS (VF_NET_SYNCED | VF_CHEAT | VF_CHEAT_ALWAYS_CHECK | VF_CHEAT_NOCHECK | VF_READONLY | VF_CONST_CVAR)
#if defined(_RELEASE)
-#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
-#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val /* _onchangefunction consumed; callback not available */
-#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
-#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
-#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
-#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
-#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
-#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
-#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
-#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
-#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
-#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
+#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
+#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val /* _onchangefunction consumed; callback not available */
+#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
+#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
+#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
+#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
+#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
+#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
+#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
+#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
+#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
+#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
#define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) /* consumed; command not available */
#else
-#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
#endif // defined(_RELEASE)
//
////////////////////////////////////////////////////////////////////////////////
@@ -1586,19 +1585,19 @@ static void AssertConsoleExists(void)
// TODO Registering all cvars for Dedicated server as well. Currently CrySystems have no concept of Dedicated server with cmake.
// If we introduce server specific targets for CrySystems, we can add DEDICATED_SERVER flags to those and add the flag back in here.
#if defined(_RELEASE)
-#define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_INT64_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR2_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR3_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_CVAR3_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
-#define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_INT64_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR2_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR3_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_CVAR3_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
+#define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
#else
#define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
#define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
diff --git a/Code/Legacy/CryCommon/ITexture.h b/Code/Legacy/CryCommon/ITexture.h
index 5b9b43ceb5..170e3b6709 100644
--- a/Code/Legacy/CryCommon/ITexture.h
+++ b/Code/Legacy/CryCommon/ITexture.h
@@ -314,8 +314,8 @@ public:
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const
{
- COMPILE_TIME_ASSERT(eTT_MaxTexType <= 255);
- COMPILE_TIME_ASSERT(eTF_MaxFormat <= 255);
+ static_assert(eTT_MaxTexType <= 255);
+ static_assert(eTF_MaxFormat <= 255);
/*LATER*/
}
diff --git a/Code/Legacy/CryCommon/Linux32Specific.h b/Code/Legacy/CryCommon/Linux32Specific.h
index e66838f431..6812ddb818 100644
--- a/Code/Legacy/CryCommon/Linux32Specific.h
+++ b/Code/Legacy/CryCommon/Linux32Specific.h
@@ -18,10 +18,6 @@
#define _CPU_X86
//#define _CPU_SSE
-#define RC_EXECUTABLE "rc"
-#define USE_CRT 1
-#define SIZEOF_PTR 4
-
//////////////////////////////////////////////////////////////////////////
// Standard includes.
//////////////////////////////////////////////////////////////////////////
@@ -97,10 +93,6 @@ typedef unsigned char byte;
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
- static type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
- const type __attribute__ ((aligned(alignment))) name;
#include "LinuxSpecific.h"
diff --git a/Code/Legacy/CryCommon/Linux64Specific.h b/Code/Legacy/CryCommon/Linux64Specific.h
index 0aa9321025..4dcb5f1e84 100644
--- a/Code/Legacy/CryCommon/Linux64Specific.h
+++ b/Code/Legacy/CryCommon/Linux64Specific.h
@@ -20,10 +20,6 @@
#define _CPU_AMD64
#define _CPU_SSE
-#define RC_EXECUTABLE "rc"
-#define USE_CRT 1
-#define SIZEOF_PTR 8
-
//////////////////////////////////////////////////////////////////////////
// Standard includes.
//////////////////////////////////////////////////////////////////////////
@@ -103,10 +99,6 @@ typedef uint8 byte;
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
- static type __attribute__ ((aligned(alignment))) name;
-#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
- const type __attribute__ ((aligned(alignment))) name;
#include "LinuxSpecific.h"
diff --git a/Code/Legacy/CryCommon/LinuxSpecific.h b/Code/Legacy/CryCommon/LinuxSpecific.h
index cbffae5957..a587350cb2 100644
--- a/Code/Legacy/CryCommon/LinuxSpecific.h
+++ b/Code/Legacy/CryCommon/LinuxSpecific.h
@@ -182,7 +182,6 @@ typedef int64 __int64;
typedef uint64 __uint64;
#endif
-#define THREADID_NULL -1
typedef unsigned long int threadID;
#define TRUE 1
@@ -213,27 +212,6 @@ typedef unsigned long int threadID;
#define _wtof(str) wcstod(str, 0)
-/*static unsigned char toupper(unsigned char c)
-{
- return c & ~0x40;
-}
-*/
-typedef union _LARGE_INTEGER
-{
- struct
- {
- DWORD LowPart;
- LONG HighPart;
- };
- struct
- {
- DWORD LowPart;
- LONG HighPart;
- } u;
- long long QuadPart;
-} LARGE_INTEGER;
-
-
// stdlib.h stuff
#define _MAX_DRIVE 3 // max. length of drive component
#define _MAX_DIR 256 // max. length of path component
@@ -257,21 +235,6 @@ typedef union _LARGE_INTEGER
#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */
#define _O_RANDOM 0x0010 /* file access is primarily random */
-// curses.h stubs for PDcurses keys
-#define PADENTER KEY_MAX + 1
-#define CTL_HOME KEY_MAX + 2
-#define CTL_END KEY_MAX + 3
-#define CTL_PGDN KEY_MAX + 4
-#define CTL_PGUP KEY_MAX + 5
-
-// stubs for virtual keys, isn't used on Linux
-#define VK_UP 0
-#define VK_DOWN 0
-#define VK_RIGHT 0
-#define VK_LEFT 0
-#define VK_CONTROL 0
-#define VK_SCROLL 0
-
enum
{
IDOK = 1,
@@ -285,17 +248,6 @@ enum
IDCONTINUE = 11
};
-#define ES_MULTILINE 0x0004L
-#define ES_AUTOVSCROLL 0x0040L
-#define ES_AUTOHSCROLL 0x0080L
-#define ES_WANTRETURN 0x1000L
-
-#define LB_ERR (-1)
-
-#define LB_ADDSTRING 0x0180
-#define LB_GETCOUNT 0x018B
-#define LB_SETTOPINDEX 0x0197
-
#define MB_OK 0x00000000L
#define MB_OKCANCEL 0x00000001L
#define MB_ABORTRETRYIGNORE 0x00000002L
@@ -315,22 +267,16 @@ enum
#define MB_APPLMODAL 0x00000000L
-#define MF_STRING 0x00000000L
-
#define MK_LBUTTON 0x0001
#define MK_RBUTTON 0x0002
#define MK_SHIFT 0x0004
#define MK_CONTROL 0x0008
#define MK_MBUTTON 0x0010
-#define MK_ALT ( 0x20 )
-
#define SM_MOUSEPRESENT 0x00000000L
#define SM_CMOUSEBUTTONS 43
-#define USER_TIMER_MINIMUM 0x0000000A
-
#define VK_TAB 0x09
#define VK_SHIFT 0x10
#define VK_MENU 0x12
@@ -338,11 +284,6 @@ enum
#define VK_SPACE 0x20
#define VK_DELETE 0x2E
-#define VK_NUMPAD1 0x61
-#define VK_NUMPAD2 0x62
-#define VK_NUMPAD3 0x63
-#define VK_NUMPAD4 0x64
-
#define VK_OEM_COMMA 0xBC // ',' any country
#define VK_OEM_PERIOD 0xBE // '.' any country
#define VK_OEM_3 0xC0 // '`~' for US
@@ -529,36 +470,11 @@ inline int64 CryGetTicksPerSec()
inline int _CrtCheckMemory() { return 1; };
-inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength)
-{
- char path[PATH_MAX];
-
- if (realpath(relPath, path) == NULL)
- {
- return NULL;
- }
- const size_t len = std::min(strlen(path), maxLength - 1);
- memcpy(absPath, path, len);
- absPath[len] = 0;
- return absPath;
-}
-
typedef void* HGLRC;
typedef void* HDC;
typedef void* PROC;
typedef void* PIXELFORMATDESCRIPTOR;
-#define SCOPED_ENABLE_FLOAT_EXCEPTIONS
-
-// Linux_Win32Wrapper.h now included directly by platform.h
-//#include "Linux_Win32Wrapper.h"
-
-#define closesocket close
-inline int WSAGetLastError()
-{
- return errno;
-}
-
template
char (*RtlpNumberOf( T (&)[N] ))[N];
diff --git a/Code/Legacy/CryCommon/Linux_Win32Wrapper.h b/Code/Legacy/CryCommon/Linux_Win32Wrapper.h
index 23cd7faf7f..2de17e6b28 100644
--- a/Code/Legacy/CryCommon/Linux_Win32Wrapper.h
+++ b/Code/Legacy/CryCommon/Linux_Win32Wrapper.h
@@ -490,8 +490,6 @@ extern void adaptFilenameToLinux(char* rAdjustedFilename);
extern const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned int len);//returns 0 if identical
extern void replaceDoublePathFilename(char* szFileName);//removes "\.\" to "\" and "/./" to "/"
-//////////////////////////////////////////////////////////////////////////
-extern char* _fullpath(char* absPath, const char* relPath, size_t maxLength);
//////////////////////////////////////////////////////////////////////////
extern void _makepath(char* path, const char* drive, const char* dir, const char* filename, const char* ext);
diff --git a/Code/Legacy/CryCommon/MacSpecific.h b/Code/Legacy/CryCommon/MacSpecific.h
index 30bcd6c6db..0533a1b556 100644
--- a/Code/Legacy/CryCommon/MacSpecific.h
+++ b/Code/Legacy/CryCommon/MacSpecific.h
@@ -24,40 +24,6 @@
#define _CPU_SSE
#define PLATFORM_64BIT
-#define USE_CRT 1
-#define SIZEOF_PTR 8
-
typedef uint64_t threadID;
-
-// curses.h stubs for PDcurses keys
-#define PADENTER KEY_MAX + 1
-#define CTL_HOME KEY_MAX + 2
-#define CTL_END KEY_MAX + 3
-#define CTL_PGDN KEY_MAX + 4
-#define CTL_PGUP KEY_MAX + 5
-
-// stubs for virtual keys, isn't used on Mac
-#define VK_UP 0
-#define VK_DOWN 0
-#define VK_RIGHT 0
-#define VK_LEFT 0
-#define VK_CONTROL 0
-#define VK_SCROLL 0
-
-#define MAC_NOT_IMPLEMENTED assert(false);
-
-
-typedef enum
-{
- eDAContinue,
- eDAIgnore,
- eDAIgnoreAll,
- eDABreak,
- eDAStop,
- eDAReportAsBug
-} EDialogAction;
-
-extern EDialogAction MacOSXHandleAssert(const char* condition, const char* file, int line, const char* reason, bool);
-
#endif // CRYINCLUDE_CRYCOMMON_MACSPECIFIC_H
diff --git a/Code/Legacy/CryCommon/Options.h b/Code/Legacy/CryCommon/Options.h
index 925f1f747e..935c8bd371 100644
--- a/Code/Legacy/CryCommon/Options.h
+++ b/Code/Legacy/CryCommon/Options.h
@@ -80,7 +80,7 @@ private:
typedef Struc TThis; typedef Int TInt; \
TInt Mask() const { return *(const TInt*)this; } \
TInt& Mask() { return *(TInt*)this; } \
- Struc(TInt init = 0) { COMPILE_TIME_ASSERT(sizeof(TThis) == sizeof(TInt)); Mask() = init; } \
+ Struc(TInt init = 0) { static_assert(sizeof(TThis) == sizeof(TInt)); Mask() = init; } \
#define BIT_VAR(Var) \
TInt _##Var : 1; \
diff --git a/Code/Legacy/CryCommon/StringUtils.h b/Code/Legacy/CryCommon/StringUtils.h
index ffd1001f95..d6c3d829d2 100644
--- a/Code/Legacy/CryCommon/StringUtils.h
+++ b/Code/Legacy/CryCommon/StringUtils.h
@@ -65,7 +65,7 @@ namespace CryStringUtils_Internal
template
inline bool strcpy_with_clamp(TChar* const dst, size_t const dst_size_in_bytes, const TChar* const src, size_t const src_size_in_bytes)
{
- COMPILE_TIME_ASSERT(sizeof(TChar) == sizeof(char) || sizeof(TChar) == sizeof(wchar_t));
+ static_assert(sizeof(TChar) == sizeof(char) || sizeof(TChar) == sizeof(wchar_t));
if (!dst || dst_size_in_bytes < sizeof(TChar))
{
@@ -97,7 +97,7 @@ namespace CryStringUtils_Internal
template
inline bool strcat_with_clamp(TChar* const dst, size_t const dst_size_in_bytes, const TChar* const src, size_t const src_size_in_bytes)
{
- COMPILE_TIME_ASSERT(sizeof(TChar) == sizeof(char) || sizeof(TChar) == sizeof(wchar_t));
+ static_assert(sizeof(TChar) == sizeof(char) || sizeof(TChar) == sizeof(wchar_t));
if (!dst || dst_size_in_bytes < sizeof(TChar))
{
diff --git a/Code/Legacy/CryCommon/UnicodeBinding.h b/Code/Legacy/CryCommon/UnicodeBinding.h
index e6e82aaf49..7a058650b5 100644
--- a/Code/Legacy/CryCommon/UnicodeBinding.h
+++ b/Code/Legacy/CryCommon/UnicodeBinding.h
@@ -211,7 +211,7 @@ namespace Unicode
>::type
>::type CharType;
static const size_t FixedSize = extent::value;
- COMPILE_TIME_ASSERT(!is_array::value || FixedSize > 0);
+ static_assert(!is_array::value || FixedSize > 0);
static const bool isConstArray = is_array::value && is_const::type>::value;
static const bool isBufferArray = is_array::value && !isConstArray;
static const bool isPointer = is_pointer::value;
@@ -393,7 +393,7 @@ namespace Unicode
sizeof(CharType) == 1 ? eEncoding_UTF8 :
sizeof(CharType) == 2 ? eEncoding_UTF16 :
eEncoding_UTF32;
- COMPILE_TIME_ASSERT(value != eEncoding_UTF32 || sizeof(CharType) == 4);
+ static_assert(value != eEncoding_UTF32 || sizeof(CharType) == 4);
};
// SBindCharacter:
@@ -408,7 +408,7 @@ namespace Unicode
template
struct SBindCharacter
{
- COMPILE_TIME_ASSERT(is_arithmetic::value);
+ static_assert(is_arithmetic::value);
typedef typename remove_cv::type UnqualifiedType;
typedef typename conditional::type type;
};
@@ -417,7 +417,7 @@ namespace Unicode
{
typedef typename conditional::type type;
typedef typename SDependentType::type ActuallyQChar; // Force two-phase name lookup on QChar.
- COMPILE_TIME_ASSERT(sizeof(ActuallyQChar) == sizeof(type)); // In case Qt ever changes QChar.
+ static_assert(sizeof(ActuallyQChar) == sizeof(type)); // In case Qt ever changes QChar.
};
// SBindPointer:
@@ -425,7 +425,7 @@ namespace Unicode
template
struct SBindPointer
{
- COMPILE_TIME_ASSERT(is_pointer::value || is_array::value);
+ static_assert(is_pointer::value || is_array::value);
typedef typename conditional<
is_pointer::value,
typename remove_pointer::type,
@@ -458,8 +458,8 @@ namespace Unicode
{
// Allow casts from pointer-to-integral to unrelated pointer-to-integral, provided they are of the same size.
typedef typename remove_pointer::type TargetChar;
- COMPILE_TIME_ASSERT(is_integral::value && is_integral::value);
- COMPILE_TIME_ASSERT(sizeof(SourceChar) == sizeof(TargetChar));
+ static_assert(is_integral::value && is_integral::value);
+ static_assert(sizeof(SourceChar) == sizeof(TargetChar));
return reinterpret_cast(ptr);
}
template
@@ -467,8 +467,8 @@ namespace Unicode
{
// Allow casts from pointer-to-QChar to unrelated pointer-to-integral, provided they are of the same size.
typedef typename remove_pointer::type TargetChar;
- COMPILE_TIME_ASSERT(is_integral::value);
- COMPILE_TIME_ASSERT(sizeof(SourceChar) == sizeof(TargetChar));
+ static_assert(is_integral::value);
+ static_assert(sizeof(SourceChar) == sizeof(TargetChar));
return reinterpret_cast(ptr);
}
template
@@ -612,7 +612,7 @@ namespace Unicode
template
inline void Feed(const InputStringType& in, Sink& out, integral_constant)
{
- COMPILE_TIME_ASSERT(is_array::value && extent::value > 0);
+ static_assert(is_array::value && extent::value > 0);
typedef typename SBindPointer::type PointerType;
const size_t length = extent::value - 1;
PointerType ptr = SafeCast(in);
@@ -630,7 +630,7 @@ namespace Unicode
template
inline void Feed(const InputStringType& in, Sink& out, integral_constant)
{
- COMPILE_TIME_ASSERT(is_array::value && extent::value > 0);
+ static_assert(is_array::value && extent::value > 0);
typedef typename SBindPointer::type PointerType;
typedef typename SBindPointer::BoundCharType CharType;
const size_t length = extent::value;
@@ -652,7 +652,7 @@ namespace Unicode
template
inline void Feed(const InputStringType& in, Sink& out, integral_constant)
{
- COMPILE_TIME_ASSERT(is_pointer::value);
+ static_assert(is_pointer::value);
typedef typename SBindPointer::type PointerType;
typedef typename SBindPointer::BoundCharType CharType;
PointerType ptr = SafeCast(in);
@@ -677,7 +677,7 @@ namespace Unicode
template
inline void Feed(const InputCharType& in, Sink& out, integral_constant)
{
- COMPILE_TIME_ASSERT(is_arithmetic::value);
+ static_assert(is_arithmetic::value);
const uint32 item = static_cast(in);
out(item);
}
@@ -711,7 +711,7 @@ namespace Unicode
template
inline size_t EncodedLength(const InputStringType& in, integral_constant)
{
- COMPILE_TIME_ASSERT(is_array::value && extent::value > 0);
+ static_assert(is_array::value && extent::value > 0);
return extent::value - 1;
}
@@ -720,7 +720,7 @@ namespace Unicode
template
inline size_t EncodedLength(const InputStringType& in, integral_constant)
{
- COMPILE_TIME_ASSERT(is_array::value && extent::value > 0);
+ static_assert(is_array::value && extent::value > 0);
typedef typename remove_extent::type CharType;
return SCharacterTrait::StrNLen(in, extent::value);
}
@@ -738,7 +738,7 @@ namespace Unicode
template
inline size_t EncodedLength(const InputStringType& in, integral_constant)
{
- COMPILE_TIME_ASSERT(is_pointer::value);
+ static_assert(is_pointer