Commit Graph

982 Commits (c9432dc5e0a2b95d72a474c9a8add7bd59ceea23)

Author SHA1 Message Date
Nicholas Van Sickle 26566a06d2
Merge pull request #7565 from aws-lumberyard-dev/nvsickle/DomPrefixTree
Add DomPrefixTree, a DOM path => value lookup structure
4 years ago
lumberyard-employee-dm ba48ef3949
GCC Build fix. (#7659)
GCC doesn't accept accessing member variables inside the noexcept expression of a member function.

GCC also requires that template specializations for an inner template be outside of all classes.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
Chris Galvan c2d6ba0c69
Merge pull request #7625 from aws-lumberyard-dev/cgalvan/AddSupportForUNORM_SRGB
Added support for several UNORM_SRGB formats
4 years ago
Nicholas Van Sickle de8b1496f0 Update DomPrefixTree range ctor with better validation
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Nicholas Van Sickle f60a24e07d Add support for Range-based DomPrefixTree construction, fix initializer_list
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Ronald Koppers f2378fc8d8
Merge pull request #7561 from aws-lumberyard-dev/ConfigurableStack
Improved the way the Settings Registry can handle stacks/arrays.
4 years ago
Nicholas Van Sickle e149abe550 Tidy a bit of API
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
AMZN-koppersr f91ea8de13 Removed #pragma once in cpp file.
Signed-off-by: AMZN-koppersr <82230785+AMZN-koppersr@users.noreply.github.com>
4 years ago
Nicholas Van Sickle 5543a0d32d Fix non-unity builds again
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Nicholas Van Sickle f934984ffe Address review feedback:
- Use `unordred_map` (speed is about the same but providing a hash is slightly nicer than operator<)
- Do better arg forwarding where applicable
- Swap EXPECT_ test ordering

Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
AMZN-koppersr 9bd487e3bd Minor fixes to the configurable stack based on provided feedback.
Signed-off-by: AMZN-koppersr <82230785+AMZN-koppersr@users.noreply.github.com>
4 years ago
Nicholas Van Sickle 0459aae295 Merge remote-tracking branch 'upstream/development' into nvsickle/DomPrefixTree 4 years ago
Chris Burel 28049f6321
Merge pull request #7633 from aws-lumberyard-dev/fixWindowsClangBuild
Fix windows clang build
4 years ago
lumberyard-employee-dm cf9825d37e
Mac Runtime Fix: Up the hard coded size for the HpAllocator buffer to 18KiB (#7634)
* Up the hard coded size for the HpAllocator buffer to 18KiB

Added a static assert in the HphaSchema.cpp file to validate that the
HpAllocator aligned storage buffer is at least the size of the
HpAllocator class.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Removed comment blocks with username from HphaSchema.h

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
Chris Burel 377da0ed0c Ignore unused benchmark state variables
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
lumberyard-employee-dm 92cd457c25
MacOS build fix (#7627)
* MacOS build fix

Updated the HpAllocator::bucket to align upwards to the nearest power of
2.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding static assets to validate teh AlignUpToPowerOfTwo function.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
Chris Burel 0b317ee0f5
Merge pull request #7566 from aws-lumberyard-dev/fixClangWindowsBuild
Fix clang windows build
4 years ago
Chris Galvan 8cf29ebc25 Added support for several UNORM_SRGB formats
Signed-off-by: Chris Galvan <chgalvan@amazon.com>
4 years ago
lumberyard-employee-dm 6f52fcb9f0
Various Benchmark Fixes for AzCore (#7611)
Fixed crash in Allocators Benchmark multithreaded test due to the HPHA schema not having proper multithread protection around the `mFreeTree` member in `tree_get_unused_memory` function.
The `mFreeTree intrusive set is able to modified on multiple threads.

Replaced the custom intrusive_list implementation n HPHA schema with AZStd::intrusive_list

Added a `ScopedAllocatorBenchmarkEnvironment` class to provide an RAI mechanism for initializing the SystemAllocator in Benchmark Test

Rermoved the `AzCoreBenchmarkEnvironment` in lieu of the `ScopedAllocatorBenchmarkEnvironment` class

Fixed assert when running Allocator Benchmarks in debug due to mismatch PauseTiming/ResumeTiming in Allocator Benchmark Fixtures

Added `ScopedRegisterBenchmarkEnvironment` RAII class to provide lifetime guarantees on BenchmarkEnvironments registered via the `AZ_UNIT_TEST_HOOK`

Initialized the intrusive_multiset_node members to nullptr in all build configurations instead of only debug as the cost negligible and it is useful for debugging.

fixes LYN-10210

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
lumberyard-employee-dm d7ee248df5
Range adaptor support (#7388)
* Updated the SFINAE checks in concepts.h and range.h

To use conjunction and disjunction for short-circuiting behavior.

Replaced AZStd::optional implementation with std::optional alias

Added range adaptor support and the following views: ref_view,
owning_view

Added bitwise or(|) overload for chaining range adaptor closures together

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding indirectly invocable concepts.

These concepts are used to determine whether a callable can be invoked
with a dereferenced iterator instance.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Add implementation of range relational function objects

Add implementation of range min max functions which uses the range
relation function objects(ranges::less, ranges::equal_to, etc...)

This is needed to implement ranges::zip_view

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding interface for zip_view which compiles successfully

The implementation for the zip view functions still need to be filled.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding function definitions for zip_view classes.

Adding empty header of subrange.h for the ranges::subrange class

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding additional view implementations.

The following range and view classes have been added: empty_view,
single_view and subrange.

Moved the AZ_NO_UNIQUE_ADDRESS macro to PlatformDef.h to allow other
code to specify the [[no_unique_address]] attribute.

Added additional test for view structures.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding missing includes for non-unity builds

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Workaround for NDK21 clang 9.0.9 compile issue.

The AZStd::ranges::zip_view::iterator::iter_swap friend function is in the
AZStd::ranges namespace, while the customization point object of
`AZStd::ranges::customization_point_object::iter_swap` is in the regular
namespace of `AZStd::ranges` and the inline namespace of
`customization_point`.

This issue is fixed in NDK23, but as Jenkins uses NDK21 at the time, the
entire zip_view implementation has moved to inline namespace of
`zip_view_internal`

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added iterator algorithm requiremetn concepts

Fixed the ambiguity in the ranges::iter_swap exchange overload to
exclude itself as a candidate if the iterator reference types are
swappable with each other.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding type alias for borrowed_subrange_t

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed convertible to ref_view check in the ranges::all
customization_point

Updated SFINAE detection of whether AZStd::to_address is invocable

Moved the

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed private variable access in ranges::subrange get specialization.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Removing ranges::view constraint from the ranges::views::single
customization_point.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding C++23 range overload for string_view.

It is detailed in the [C++draft strings](https://eel.is/c++draft/strings#lib:basic_string_view,constructor____) section

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding implementations of ranges, find, search, mismatch and equal
functions.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding implementation of ranges split_view along with test.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding const overloads to SceneAPI ProxyPointer container

The Proxy Pointer class operator* and operator-> was unable to be
invoked with a const instance before. Now it returns a const view of the
pointer it contains.
This allows it to be invoked in `AZStd::to_address` as part of an SINAE
context for the contiguous_iterator concept

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Refactored the to_address implementation to better work with SFINAE.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding general non-unity build fixes

This is unrelated to the RangeAdaptor changes.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Allow range algorithms to be used with rvalue ranges

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Workaround MSVC Internal Compiler erroy by removing enable_if
condition in the operator bool of the view_interface class.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Corrected the non_propagating_cache helper class to have public
functions

Fixed the order of creating the perfect forwarding call wrapper for an
outer closure around another closure.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Specialized the borrowed_range and view concepts

For the AZ PathView class, since it is a immutable view around a path.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Removed inline namespace around the zip_view class.

It was needed to workaround a clang 10 or below issue where a friend
function in a namespace and a variable within underneath an inline
namespace within the function namespace would cause an improper symbol
redefinition.

The workaround is to create a placeholder namespace containing the
inline namespace and then bring that placeholder namespace into the
parent scope.

https://bugs.llvm.org/show_bug.cgi?id=37556

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding implementation of the elemetns_view and join_view classes

It is up to date with the standard as of the current draft:
https://eel.is/c++draft/ranges.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Separated definitions of concepts out of concepts.h

This allows the ranges::iter_swap and ranges::swap customization point to be moved
outside of the concepts folder and into the ranges folder.

The concepts.h header previously had to define those objects to avoid
circular dependencies.

Added the work around for ranges::iter_swap and ranges::iter_move
customization_point causing an improper symbol redefinition in clang 10
or below: https://bugs.llvm.org/show_bug.cgi?id=37556

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Alias more std:: names into the AZStd namespace.

Removed our custom implementation of toaddress.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding more range view test.

The join_view and elements_view classes now have UnitTest.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding deduction guides for AZStd associative containers

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Moved zip_view::sentinel iterator accessor function to zip_view.inl

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed variable shadowing issues with clang 12+

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
Chris Burel d4eb310950 Mark unused variables as unused
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel b79d5faa16 Remove unused captures
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel ddb66786dc Remove unused variable
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel 664403c5de Mark benchmark state variables in for loops as unused in benchmarks
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel 36487c1588 Fix alignment of `CONTEXT` variable
The previous code had the `alignas()` in the wrong place, it needs to be
left of the typename.

Furthermore, `CONTEXT` has a default alignment of 16, so using `alignas(8)`
underaligns.

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel 024cbdd2cd Remove unused `azSmyType` variable
There's a lot of work done to set the value of this variable, but nothing
read from it.

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel b44c362af0 Fix comparing an array in a conditional, which is always true
Instead, check the intent of the original code, if the `szImg` string is
not empty.

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Chris Burel cff6fb97af Fix "expression result unused" warning
This macro was expecting that parenthesis used in the macro would be
removed during macro expansion, when they are not removed. The result was
a function call like this:

```cpp
AZ_Assert(g_SymGetSearchPath != 0, ("Can not load %s function!","SymGetSearchPath"));
```

The parenthesis cause the contents of the parenthsis to be evaluated first,
and the result is an expression using the comma operator. The comma
operator evaluates the left expression, discards the result, then
evaluates the right expression, and returns that. So the above dropping
the message, and just leaving:

```cpp
AZ_Assert(g_SymGetSearchPath != 0, "SymGetSearchPath");
```

Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Nicholas Van Sickle 27c6388c3c Add DomPrefixTree, a DOM path => value lookup structure
This is Document Property Editor work I've pulled out as I needed it in a few places, and the API may be generally useful. Real-world performance measurements will need to be done, if we have path lookup based bottlenecks we can consider adopting a contiguous memory approach with a sorted vector.

Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
AMZN-koppersr d00436e26a Improved the way the Settings Registry can handle stacks/arrays.
The ConfigurableStack makes configuring stacks and arrays through the Settings Registry easier than using direct serialization to a container like AZStd::vector. It does this by using JSON Objects rather than JSON arrays, although arrays are supported for backwards compatibility. Two key words were added:
    - $stack_before : Insert the new entry before the referenced entry. Referencing is done by name.
    - $stack_after  : Insert the new entry after the referenced entry. Referencing is done by name.
to allow inserting new entries at specific locations. An example of a .setreg file at updates existing settings would be:
// Original settings
{
    "Settings in a stack":
    {
        "AnOriginalEntry":
        {
            "MyValue": "hello",
            "ExampleValue": 84
        },
        "TheSecondEntry":
        {
            "MyValue": "world"
        }
    }
}

// Customized settings.
{
    "Settings in a stack":
    {
        // Add a new entry before "AnOriginalEntry" in the original document.
        "NewEntry":
        {
            "$stack_before": "AnOriginalEntry",
            "MyValue": 42
        },
        // Add a second entry after "AnOriginalEntry" in the original document.
        "SecondNewEntry":
        {
            "$stack_after": "AnOriginalEntry",
            "MyValue": "FortyTwo".
        },
        // Update a value in "AnOriginalEntry".
        "AnOriginalEntry":
        {
            "ExampleValue": 42
        },
        // Delete the "TheSecondEntry" from the settings.
        "TheSecondEntry" : null,
    }
}

The ConfigurableStack uses an AZStd::shared_ptr to store the values. This supports settings up a base class and specifying derived classes in the settings, but requires that the base and derived classes all have a memory allocator associated with them (i.e. by using the "AZ_CLASS_ALLOCATOR" macro) and that the relation of the classes is reflected. Loading a ConfigurableStack can be done using the GetObject call on the SettingsRegistryInterface.

Signed-off-by: AMZN-koppersr <82230785+AMZN-koppersr@users.noreply.github.com>
4 years ago
Nicholas Van Sickle bc3f957270
Merge pull request #7093 from aws-lumberyard-dev/nvsickle/DomPatch
Add AZ::Dom::Patch, a Generic DOM analog to JSON patch
4 years ago
Nicholas Van Sickle 42c2243eaa Fix benchmark non-unity build
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Nicholas Van Sickle d1bb5a0543 Move DOM delta comparison to its own file, enhance inverting moves
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Nicholas Lawson 3337bdd05d
Update Lua to 5.4.4 (#7460)
* Update lua to 5.4.4 (fixes #7267)

Signed-off-by: lawsonamzn <70027408+lawsonamzn@users.noreply.github.com>
4 years ago
Nicholas Van Sickle 5b8176e99b Address some review feedback
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Nicholas Van Sickle dec3def9eb Merge remote-tracking branch 'upstream/development' into nvsickle/DomPatch 4 years ago
Steve Pham 4d4f10beb8
Clang/GCC compiler settings update [SECURITY] (#7358)
- Add the following compilation flags for clang
  -fpie
  -fstack-protector-all
  -fstack-check (non-release)

- Add the following compilation flags for gcc
  -fpie
  -fstack-protector-all

- Fix -Wunused-result errors from above compilation flag updates

- Add _FORTIFY_SOURCE=2 to GCC DEFINES

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
4 years ago
Steve Pham 69e0090a0b
Remove -Wno-return-local-addr warning suppression for GCC
- Remove '-Wno-return-local-addr' warning suppression flag for GCC
- Fixed discovered error resulting from -Wreturn-local-addr

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>

* Remove extra ws

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
4 years ago
Steve Pham 71cc3a2568
Remove -Wno-comment warning suppression
Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
4 years ago
rgba16f 0a5e61b834
Update default AZStd thread priority on Apple platforms to avoid being prevented from using 100% of a core (#7295)
PAL-ified default thread priority for pthread platforms.
Fix threads not getting named on Apple platforms by setting the thread name ptr on the thread_info struct.

Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
4 years ago
amzn-sj 112e310419
[Serialization] Add support for updating the values of existing keys in associative containers (#6832)
* Add support for updating the values of existing keys in associative containers

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Map/Unordered Map serialization updates values corresponding to existing keys by default. Multimaps always add a new entry for existing keys.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Fix unused parameter warning

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Update comparison function for test case

Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
Scott Romero 8ecaaf36c0
[development] updated Profiler interface to allow the forwarding of format string arguments (#7173)
Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
4 years ago
Ronald Koppers b695bfa832
Merge pull request #7145 from aws-lumberyard-dev/Prefabs/PlayInEditorMissingAssets
Fixed missing assets when entering Play-In-Editor.
4 years ago
Nicholas Van Sickle 155cc5845b Add Path::IsEmpty
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Nicholas Van Sickle 73f166241e Address review feedback
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Scott Romero f7f17c98b4
[development] fixed ambiguous 'byte' type MSVC build error (#7184)
- fully quality 'byte' type in AZStd::span
- remove unnecessary 'using namespace AZStd;' statement from AssetCatalog tests

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
4 years ago
AMZN-koppersr 4471b7008d Merge branch 'development' into Prefabs/PlayInEditorMissingAssets 4 years ago
Esteban Papp 75d39d9ce5
makes bucket variables atomic (#7179)
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
lumberyard-employee-dm b9824ed172
Updated all array_view uses with the C++20 span. (#7157)
* Updated all array_view uses with the C++20 span.

The updates were done in the following order
1. `AZStd::array_view<([^>].+)\* ?>`  -> `AZStd::span<\1 const>`
2. `AZStd::array_view<(?:const )(.+)>` -> `AZStd::span<const \1>`
3. `AZStd::array_view` -> `AZStd::span`

Removed the implementation of array_view.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added missing whitespace between `const` and the typename for spans.

Updated the ShaderTest comparison of the ShaderResourceGroupLayout span
to compare the sizes as well

Updated comments on some of the methods that stated that they return "an
array" to mention they return "a span".

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
lumberyard-employee-dm 52f1ef84c7
Fixed string_view compilation in GCC 10+. (#7153)
* Fixed string_view compilation in GCC 10+.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* More GCC 10+ Fixes.

GCC 11 seems to have an issue with linkage regarding using a lambda as a default parameter in a function declaration.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* GCC10+ Fix - Fixed binding to a temporary references.

> error: loop variable ‘pathName’ of type ‘const QString&’ binds to a temporary constructed from type ‘const char* const’ [-Werror=range-loop-construct]
  415 |     for (const QString& pathName : { "CrySystem",

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago