diff --git a/Code/Framework/AzCore/Tests/TaskTests.cpp b/Code/Framework/AzCore/Tests/TaskTests.cpp index 4f53772d51..53fa89900e 100644 --- a/Code/Framework/AzCore/Tests/TaskTests.cpp +++ b/Code/Framework/AzCore/Tests/TaskTests.cpp @@ -447,13 +447,13 @@ namespace UnitTest { x -= 1; }); - - // a <-- Root - // / \ - // b c - // \ / - // d - + /* + a <-- Root + / \ + b c + \ / + d + */ a.Precedes(b, c); d.Follows(b, c); @@ -522,20 +522,20 @@ namespace UnitTest { x -= 1; }); - - // NOTE: The ideal way to express this topology is without the wait on the subgraph - // at task g, but this is more an illustrative test. Better is to express the entire - // graph in a single larger graph. - // a <-- Root - // / \ - // b c - f - // \ \ \ - // \ e - g - // \ / - // \ / - // \ / - // d - + /* + NOTE: The ideal way to express this topology is without the wait on the subgraph + at task g, but this is more an illustrative test. Better is to express the entire + graph in a single larger graph. + a <-- Root + / \ + b c - f + \ \ \ + \ e - g + \ / + \ / + \ / + d + */ a.Precedes(b); a.Precedes(c); b.Precedes(d); @@ -593,17 +593,17 @@ namespace UnitTest { x += 0b1000; }); - - // a <-- Root - // / \ - // b c - f - // \ \ \ - // \ e - g - // \ / - // \ / - // \ / - // d - + /* + a <-- Root + / \ + b c - f + \ \ \ + \ e - g + \ / + \ / + \ / + d + */ a.Precedes(b, c); b.Precedes(d); c.Precedes(e, f); diff --git a/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.h b/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.h index 76b7958085..30a9f99436 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.h +++ b/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.h @@ -19,13 +19,15 @@ #define AZ_DebugSecureSocket(...) #define AZ_DebugSecureSocketConnection(window, fmt, ...) -//#define AZ_DebugUseSocketDebugLog -//#define AZ_DebugSecureSocket AZ_TracePrintf -//#define AZ_DebugSecureSocketConnection(window, fmt, ...) \ -//{\ -// AZStd::string line = AZStd::string::format(fmt, __VA_ARGS__);\ -// this->m_dbgLog += line;\ -//} +/* + #define AZ_DebugUseSocketDebugLog + #define AZ_DebugSecureSocket AZ_TracePrintf + #define AZ_DebugSecureSocketConnection(window, fmt, ...) \ + {\ + AZStd::string line = AZStd::string::format(fmt, __VA_ARGS__);\ + this->m_dbgLog += line;\ + } +*/ #if AZ_TRAIT_GRIDMATE_SECURE_SOCKET_DRIVER_HOOK_ENABLED struct ssl_st; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp index 0387ec5c7b..2b1e822db4 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp @@ -999,79 +999,81 @@ namespace ImageProcessingAtom } // TODO: not working yet, debug and enable - //static void SplitAlgorithm(const void* i, void* o, struct prcparm* templ, int threads = 8) - //{ - // struct prcparm fraction[32]; - // int t, istart = 0, sstart = 0, ostart = 0; - // const bool scaler = true; - - // int theight = 0; - - // /* prepare data to be emitted to the threads */ - // for (t = 0; t < threads; t++) - // { - // fraction[t] = *templ; - - // /* adjust the processing-region according to the available threads */ - // { - //#undef split /* only prefix-threads need aligned transpose (for not trashing suffix-thread data) */ - //#define split(rows) !scaler \ - // ? ((rows * (t + 1)) / threads) & (~(t != threads - 1 ? 15 : 0)) \ - // : ((rows * (t + 1)) / threads) & (~0) - - // /* area covered */ - // const int inrows = (fraction[t].regional ? fraction[t].region.inrows : fraction[t].inrows); - // const int incols = (fraction[t].regional ? fraction[t].region.incols : fraction[t].incols); - // const int subrows = (fraction[t].regional ? fraction[t].region.subrows : fraction[t].subrows); - // const int subcols = (fraction[t].regional ? fraction[t].region.subcols : fraction[t].subcols); - // const int outrows = (fraction[t].regional ? fraction[t].region.outrows : fraction[t].outrows); - // const int outcols = (fraction[t].regional ? fraction[t].region.outcols : fraction[t].outcols); - - // /* splitting blocks */ - // const int istop = split(inrows), sstop = split(subrows), ostop = split(outrows); - // const int irows = istop - istart, srows = sstop - sstart, orows = ostop - ostart; - // const int icols = incols, scols = subcols, ocols = outcols; - - // AZ_Assert(irows > 0, "%s: Expect row count to be above zero!", __FUNCTION__); - // AZ_Assert(orows > 0, "%s: Expect row count to be above zero!", __FUNCTION__); - // AZ_Assert(icols > 0, "%s: Expect column count to be above zero!", __FUNCTION__); - // AZ_Assert(ocols > 0, "%s: Expect column count to be above zero!", __FUNCTION__); - - // /* now we are regional */ - // fraction[t].regional = true; - - // /* take previous regionality into account */ - // fraction[t].region.intop += istart; - // fraction[t].region.subtop += sstart; - // fraction[t].region.outtop += ostart; - // fraction[t].region.inrows = irows; - // fraction[t].region.subrows = srows; - // fraction[t].region.outrows = orows; - - // /* take previous regionality into account */ - // fraction[t].region.inleft += 0; - // fraction[t].region.subleft += 0; - // fraction[t].region.outleft += 0; - // fraction[t].region.incols = icols; - // fraction[t].region.subcols = scols; - // fraction[t].region.outcols = ocols; - - // /* advance block */ - // istart = istop; - // sstart = sstop; - // ostart = ostop; - - // /* check */ - // theight += irows; - // } - - // // the algorithm supports "i" and "o" pointing to the same memory - // CheckBoundaries((float*)i, (float*)o, &fraction[t]); - // RunAlgorithm((float*)i, (float*)o, &fraction[t]); - // } - - // AZ_Assert(theight >= (templ->regional ? templ->region.inrows : templ->inrows), "%s: Invalid height!", __FUNCTION__); - //} + /* + static void SplitAlgorithm(const void* i, void* o, struct prcparm* templ, int threads = 8) + { + struct prcparm fraction[32]; + int t, istart = 0, sstart = 0, ostart = 0; + const bool scaler = true; + + int theight = 0; + + // prepare data to be emitted to the threads + for (t = 0; t < threads; t++) + { + fraction[t] = *templ; + + // adjust the processing-region according to the available threads + { + #undef split // only prefix-threads need aligned transpose (for not trashing suffix-thread data) + #define split(rows) !scaler \ + ? ((rows * (t + 1)) / threads) & (~(t != threads - 1 ? 15 : 0)) \ + : ((rows * (t + 1)) / threads) & (~0) + + // area covered + const int inrows = (fraction[t].regional ? fraction[t].region.inrows : fraction[t].inrows); + const int incols = (fraction[t].regional ? fraction[t].region.incols : fraction[t].incols); + const int subrows = (fraction[t].regional ? fraction[t].region.subrows : fraction[t].subrows); + const int subcols = (fraction[t].regional ? fraction[t].region.subcols : fraction[t].subcols); + const int outrows = (fraction[t].regional ? fraction[t].region.outrows : fraction[t].outrows); + const int outcols = (fraction[t].regional ? fraction[t].region.outcols : fraction[t].outcols); + + // splitting blocks + const int istop = split(inrows), sstop = split(subrows), ostop = split(outrows); + const int irows = istop - istart, srows = sstop - sstart, orows = ostop - ostart; + const int icols = incols, scols = subcols, ocols = outcols; + + AZ_Assert(irows > 0, "%s: Expect row count to be above zero!", __FUNCTION__); + AZ_Assert(orows > 0, "%s: Expect row count to be above zero!", __FUNCTION__); + AZ_Assert(icols > 0, "%s: Expect column count to be above zero!", __FUNCTION__); + AZ_Assert(ocols > 0, "%s: Expect column count to be above zero!", __FUNCTION__); + + // now we are regional + fraction[t].regional = true; + + // take previous regionality into account + fraction[t].region.intop += istart; + fraction[t].region.subtop += sstart; + fraction[t].region.outtop += ostart; + fraction[t].region.inrows = irows; + fraction[t].region.subrows = srows; + fraction[t].region.outrows = orows; + + // take previous regionality into account + fraction[t].region.inleft += 0; + fraction[t].region.subleft += 0; + fraction[t].region.outleft += 0; + fraction[t].region.incols = icols; + fraction[t].region.subcols = scols; + fraction[t].region.outcols = ocols; + + // advance block + istart = istop; + sstart = sstop; + ostart = ostop; + + // check + theight += irows; + } + + // the algorithm supports "i" and "o" pointing to the same memory + CheckBoundaries((float*)i, (float*)o, &fraction[t]); + RunAlgorithm((float*)i, (float*)o, &fraction[t]); + } + + AZ_Assert(theight >= (templ->regional ? templ->region.inrows : templ->inrows), "%s: Invalid height!", __FUNCTION__); + } + */ /* #################################################################################################################### \ */ diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ParamMacros/ParamMacrosHowTo.inl b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ParamMacros/ParamMacrosHowTo.inl index e6fd6c10ba..ecf63ff5f6 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ParamMacros/ParamMacrosHowTo.inl +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ParamMacros/ParamMacrosHowTo.inl @@ -6,239 +6,241 @@ * */ -// -// This is a quick guide on how to use the parameter macros included in this folder -// -// Part I: The Pattern -// -// The aim of this macro system is to allow users to define parameters once and have the macros generate a bunch of boilerplate code for each defined parameter. -// While these macros makes things a little more complex upfront, the ability to add and remove variables in just one place without having to dig -// through multiple files every time is great for iteration speed and maintenance. To accomplish this, we use a pattern similar to the following example: -// -// Let's say we want to specify class members in one place and have the members, getters and setters be auto generated. -// First, we define a macro MY_CLASS_PARAMS that uses a yet-undefined macro MAKE_PARAM(TYPE, NAME): -// -// #define MY_CLASS_PARAMS \ -// MAKE_PARAM(float, Width) \ -// MAKE_PARAM(float, Height) \ -// MAKE_PARAM(float, Depth) \ -// -// Now we need only specify what MAKE_PARAM needs to do and then we can call the MY_CLASS_PARAMS macro to apply the logic to all defined params. For instance: -// -// #define MAKE_PARAM(TYPE, NAME) TYPE m_##NAME; -// MY_CLASS_PARAMS -// #undef MAKE_PARAM -// -// This will generate the members as follows: -// -// float m_Width; -// float m_Height; -// float m_Depth; -// -// Now elsewhere in the class definition we can generate getters and setters: -// -// #define MAKE_PARAM(TYPE, NAME) \ -// TYPE Get##NAME() { return m_##NAME; } \ -// void Set##NAME(TYPE NAME) { m_##NAME = NAME; } \ -// -// MY_CLASS_PARAMS -// -// #undef MAKE_PARAM -// -// This will generate the following: -// -// float GetWidth() { return m_Width; } -// void SetWidth(float Width) { m_Width = Width; } -// float GetHeight() { return m_Height; } -// void SetHeight(float Width) { m_Height = Height; } -// float GetDepth() { return m_Width; } -// void SetDepth(float Depth) { m_Depth = Depth; } -// -// If we wanted to generate further code for each variable, we need only redefine the MAKE_PARAM macro and invoke MY_CLASS_PARAMS -// -// ___________________________________________________________________________________________________________________________________________________ -// -// Part II: Using .inl files -// -// A key difference between the above example and our macro system is that we put macro definitions in .inl files so they can be easily reused -// If we were to reuse the above example, it would look something like this: -// -// GenerateMembers.inl -// -// #define MAKE_PARAM(TYPE, NAME) TYPE m_##NAME; -// -// GenerateGettersAndSetters.inl -// -// #define MAKE_PARAM(TYPE, NAME) \ -// TYPE Get##NAME() { return m_##NAME; } \ -// void Set##NAME(TYPE NAME) { m_##NAME = NAME; } \ -// -// BoxParams.inl -// -// MAKE_PARAM(float, Width) \ -// MAKE_PARAM(float, Height) \ -// MAKE_PARAM(float, Depth) \ -// -// CylinderParams.inl -// -// MAKE_PARAM(float, Radius) \ -// MAKE_PARAM(float, Height) \ -// -// Now we can use these .inl files to generate two classes, each with members, getters and setters -// -// class Box -// { -// // Auto-gen members from BoxParams.inl -// #include -// #include -// #undef MAKE_PARAM -// -// // Auto-gen getters and setters from BoxParams.inl -// #include -// #include -// #undef MAKE_PARAM -// } -// -// class Cylinder -// { -// // Auto-gen members from CylinderParams.inl -// #include -// #include -// #undef MAKE_PARAM -// -// // Auto-gen getters and setters from CylinderParams.inl -// #include -// #include -// #undef MAKE_PARAM -// } -// -// This will result in the following code: -// -// class Box -// { -// // Auto-gen members from BoxParams.inl -// float m_Width; -// float m_Height; -// float m_Depth; -// -// // Auto-gen getters and setters from BoxParams.inl -// float GetWidth() { return m_Width; } -// void SetWidth(float Width) { m_Width = Width; } -// float GetHeight() { return m_Height; } -// void SetHeight(float Width) { m_Height = Height; } -// float GetDepth() { return m_Width; } -// void SetDepth(float Depth) { m_Depth = Depth; } -// } -// -// class Cylinder -// { -// // Auto-gen members from CylinderParams.inl -// float m_Radius; -// float m_Height; -// -// // Auto-gen getters and setters from CylinderParams.inl -// float GetRadius() { return m_Radius; } -// void SetRadius(float Radius) { m_Radius = Raidus; } -// float GetHeight() { return m_Height; } -// void SetHeight(float Width) { m_Height = Height; } -// } -// -// As you can see, this macro pattern allows us to add a member to Box or Cylinder by adding a single line to BoxParams.inl or CylinderParams.inl -// Because of the number of classes an boiler plate code involved in creating Open 3D Engine Component, this macro system allows us to change one line -// in one file instead of changing over a dozens of lines in half a dozen files. -// -// ___________________________________________________________________________________________________________________________________________________ -// -// Part III: Using the Macros for Post Process members -// -// If you want to create a new post process, you can create a .inl file (see DepthOfFieldParams.inl for an example) and declare members using the macros below: -// -// #define AZ_GFX_BOOL_PARAM(Name, MemberName, DefaultValue) -// #define AZ_GFX_FLOAT_PARAM(Name, MemberName, DefaultValue) -// #define AZ_GFX_UINT32_PARAM(Name, MemberName, DefaultValue) -// #define AZ_GFX_VEC2_PARAM(Name, MemberName, DefaultValue) -// #define AZ_GFX_VEC3_PARAM(Name, MemberName, DefaultValue) -// #define AZ_GFX_VEC4_PARAM(Name, MemberName, DefaultValue) -// -// Where: -// Name - The name of the param that will be used for reflection and appended to setters and getters, for example Width -// MemberName - The name of the member defined inside your class, for example m_width -// DefaultValue - The default value that the member will be statically initialized to, for example 1.0f -// BOOL, FLOAT, UINT32, VEC2 etc. all designate the type of the param you are defining -// -// If you have a custom type for your parameter, you can use the AZ_GFX_COMMON_PARAM macro: -// AZ_GFX_COMMON_PARAM(Name, MemberName, DefaultValue, ValueType) -// The keywords here are the same as above, with the addition of ValueType: the custom type you want your param to be -// -// Example usages: -// -// #define AZ_GFX_VEC3_PARAM(Position, m_position, Vector3(0.0f, 0.0f, 0.0f)) -// -// #define AZ_GFX_COMMON_PARAM(Format, m_format, Format::Unknown, FormatEnum) -// -// ___________________________________________________________________________________________________________________________________________________ -// -// Part IV: Using the Macros for Post Process overrides -// -// The Post Process System allows users to specify whether settings should be overridden or not on a per-member basis. -// To enable this, when you declare a member that can be overridden by higher priority Post Process Settings, in addition -// to using the above macros to define the member, you should also use one of the following to specify the override: -// -// #define AZ_GFX_ANY_PARAM_BOOL_OVERRIDE(Name, MemberName, ValueType) -// #define AZ_GFX_INTEGER_PARAM_FLOAT_OVERRIDE(Name, MemberName, ValueType) -// #define AZ_GFX_FLOAT_PARAM_FLOAT_OVERRIDE(Name, MemberName, ValueType) -// -// Where: -// Name - The name of the param that will be used for reflection and appended to setters and getters, for example Width -// MemberName - The name of the member defined inside your class, for example m_width -// ValueType - The type of the parameter you defined (bool, float, uint32_t, Vector2 etc.) -// -// A bit more details on each of the override macros: -// -// AZ_GFX_ANY_PARAM_BOOL_OVERRIDE can be used for params of any type. The override variable will be a bool (checkbox in the UI). -// The override application is a simple binary operation: take all of the source or the target (no lerp) depending on the bool. -// -// AZ_GFX_INTEGER_PARAM_FLOAT_OVERRIDE should be used for params of integer types (int, uint, integer vectors...) The override variable -// will be a float from 0.0 to 1.0 (slider in the UI). The override will lerp between target and source using the override float -// variable. Note that for this reason the param integer type must support multiplication by a float value. -// -// AZ_GFX_FLOAT_PARAM_FLOAT_OVERRIDE should be used for params of floating point types (float, double, Vector4...) The override variable -// will be a float from 0.0 to 1.0 (slider in the UI). The override will lerp between target and source using the override float. -// -// Example usage: -// -// #define AZ_GFX_VEC3_PARAM(Position, m_position, Vector3(0.0f, 0.0f, 0.0f)) -// #define AZ_GFX_FLOAT_PARAM_FLOAT_OVERRIDE(Position, m_position, Vector3) -// -// ___________________________________________________________________________________________________________________________________________________ -// -// Part V: Defining functionality with .inl files -// -// There are many .inl fies in this folder that provide pre-defined behaviors for params declared with the above macros -// To use these files, start by including the .inl file that specifies the behavior, then include your own .inl that defines your params -// then include EndParams.inl (this will #undef all used macros so as to avoid collisions with subsequent macro usage further in the file) -// -// Here is an example of how that looks: -// -// #include <- The behavior you want (behavior is described in each file) -// #include <- Your file in which you declare your params -// #include <- This #undef a bunch of macros to avoid conflicts -// -// You may of course use your own custom behaviors by specifying your definition for the param and override macros. -// You can specify each macro individually (AZ_GFX_BOOL_PARAM, AZ_GFX_FLOAT_PARAM, AZ_GFX_UINT32_PARAM, AZ_GFX_VEC2_PARAM, etc.) -// or you can specify the AZ_GFX_COMMON_PARAM and AZ_GFX_COMMON_OVERRIDE macros if there's no difference between variable types. -// -// AZ_GFX_COMMON_PARAM and AZ_GFX_COMMON_OVERRIDE are helper macros that the other _PARAM and _OVERRIDE macros can be mapped to -// using MapAllCommon.inl, allowing you to specify one definition for all types rather than each type individually. -// Here is an example of how we can use AZ_GFX_COMMON_PARAM and AZ_GFX_COMMON_OVERRIDE to auto-generate getters for our member parameters: -// -// #define AZ_GFX_COMMON_PARAM(Name, MemberName, DefaultValue, ValueType) \ -// ValueType Get##Name() const override { return MemberName; } \ -// -// #define AZ_GFX_COMMON_OVERRIDE(Name, MemberName, ValueType, OverrideValueType) \ -// OverrideValueType Get##Name##Override() const override { return MemberName##Override; } \ -// -// #include -// #include -// #include -// +/* + + This is a quick guide on how to use the parameter macros included in this folder + + Part I: The Pattern + + The aim of this macro system is to allow users to define parameters once and have the macros generate a bunch of boilerplate code for each defined parameter. + While these macros makes things a little more complex upfront, the ability to add and remove variables in just one place without having to dig + through multiple files every time is great for iteration speed and maintenance. To accomplish this, we use a pattern similar to the following example: + + Let's say we want to specify class members in one place and have the members, getters and setters be auto generated. + First, we define a macro MY_CLASS_PARAMS that uses a yet-undefined macro MAKE_PARAM(TYPE, NAME): + + #define MY_CLASS_PARAMS \ + MAKE_PARAM(float, Width) \ + MAKE_PARAM(float, Height) \ + MAKE_PARAM(float, Depth) \ + + Now we need only specify what MAKE_PARAM needs to do and then we can call the MY_CLASS_PARAMS macro to apply the logic to all defined params. For instance: + + #define MAKE_PARAM(TYPE, NAME) TYPE m_##NAME; + MY_CLASS_PARAMS + #undef MAKE_PARAM + + This will generate the members as follows: + + float m_Width; + float m_Height; + float m_Depth; + + Now elsewhere in the class definition we can generate getters and setters: + + #define MAKE_PARAM(TYPE, NAME) \ + TYPE Get##NAME() { return m_##NAME; } \ + void Set##NAME(TYPE NAME) { m_##NAME = NAME; } \ + + MY_CLASS_PARAMS + + #undef MAKE_PARAM + + This will generate the following: + + float GetWidth() { return m_Width; } + void SetWidth(float Width) { m_Width = Width; } + float GetHeight() { return m_Height; } + void SetHeight(float Width) { m_Height = Height; } + float GetDepth() { return m_Width; } + void SetDepth(float Depth) { m_Depth = Depth; } + + If we wanted to generate further code for each variable, we need only redefine the MAKE_PARAM macro and invoke MY_CLASS_PARAMS + + ___________________________________________________________________________________________________________________________________________________ + + Part II: Using .inl files + + A key difference between the above example and our macro system is that we put macro definitions in .inl files so they can be easily reused + If we were to reuse the above example, it would look something like this: + + GenerateMembers.inl + + #define MAKE_PARAM(TYPE, NAME) TYPE m_##NAME; + + GenerateGettersAndSetters.inl + + #define MAKE_PARAM(TYPE, NAME) \ + TYPE Get##NAME() { return m_##NAME; } \ + void Set##NAME(TYPE NAME) { m_##NAME = NAME; } \ + + BoxParams.inl + + MAKE_PARAM(float, Width) \ + MAKE_PARAM(float, Height) \ + MAKE_PARAM(float, Depth) \ + + CylinderParams.inl + + MAKE_PARAM(float, Radius) \ + MAKE_PARAM(float, Height) \ + + Now we can use these .inl files to generate two classes, each with members, getters and setters + + class Box + { + // Auto-gen members from BoxParams.inl + #include + #include + #undef MAKE_PARAM + + // Auto-gen getters and setters from BoxParams.inl + #include + #include + #undef MAKE_PARAM + } + + class Cylinder + { + // Auto-gen members from CylinderParams.inl + #include + #include + #undef MAKE_PARAM + + // Auto-gen getters and setters from CylinderParams.inl + #include + #include + #undef MAKE_PARAM + } + + This will result in the following code: + + class Box + { + // Auto-gen members from BoxParams.inl + float m_Width; + float m_Height; + float m_Depth; + + // Auto-gen getters and setters from BoxParams.inl + float GetWidth() { return m_Width; } + void SetWidth(float Width) { m_Width = Width; } + float GetHeight() { return m_Height; } + void SetHeight(float Width) { m_Height = Height; } + float GetDepth() { return m_Width; } + void SetDepth(float Depth) { m_Depth = Depth; } + } + + class Cylinder + { + // Auto-gen members from CylinderParams.inl + float m_Radius; + float m_Height; + + // Auto-gen getters and setters from CylinderParams.inl + float GetRadius() { return m_Radius; } + void SetRadius(float Radius) { m_Radius = Raidus; } + float GetHeight() { return m_Height; } + void SetHeight(float Width) { m_Height = Height; } + } + + As you can see, this macro pattern allows us to add a member to Box or Cylinder by adding a single line to BoxParams.inl or CylinderParams.inl + Because of the number of classes an boiler plate code involved in creating Open 3D Engine Component, this macro system allows us to change one line + in one file instead of changing over a dozens of lines in half a dozen files. + + ___________________________________________________________________________________________________________________________________________________ + + Part III: Using the Macros for Post Process members + + If you want to create a new post process, you can create a .inl file (see DepthOfFieldParams.inl for an example) and declare members using the macros below: + + #define AZ_GFX_BOOL_PARAM(Name, MemberName, DefaultValue) + #define AZ_GFX_FLOAT_PARAM(Name, MemberName, DefaultValue) + #define AZ_GFX_UINT32_PARAM(Name, MemberName, DefaultValue) + #define AZ_GFX_VEC2_PARAM(Name, MemberName, DefaultValue) + #define AZ_GFX_VEC3_PARAM(Name, MemberName, DefaultValue) + #define AZ_GFX_VEC4_PARAM(Name, MemberName, DefaultValue) + + Where: + Name - The name of the param that will be used for reflection and appended to setters and getters, for example Width + MemberName - The name of the member defined inside your class, for example m_width + DefaultValue - The default value that the member will be statically initialized to, for example 1.0f + BOOL, FLOAT, UINT32, VEC2 etc. all designate the type of the param you are defining + + If you have a custom type for your parameter, you can use the AZ_GFX_COMMON_PARAM macro: + AZ_GFX_COMMON_PARAM(Name, MemberName, DefaultValue, ValueType) + The keywords here are the same as above, with the addition of ValueType: the custom type you want your param to be + + Example usages: + + #define AZ_GFX_VEC3_PARAM(Position, m_position, Vector3(0.0f, 0.0f, 0.0f)) + + #define AZ_GFX_COMMON_PARAM(Format, m_format, Format::Unknown, FormatEnum) + + ___________________________________________________________________________________________________________________________________________________ + + Part IV: Using the Macros for Post Process overrides + + The Post Process System allows users to specify whether settings should be overridden or not on a per-member basis. + To enable this, when you declare a member that can be overridden by higher priority Post Process Settings, in addition + to using the above macros to define the member, you should also use one of the following to specify the override: + + #define AZ_GFX_ANY_PARAM_BOOL_OVERRIDE(Name, MemberName, ValueType) + #define AZ_GFX_INTEGER_PARAM_FLOAT_OVERRIDE(Name, MemberName, ValueType) + #define AZ_GFX_FLOAT_PARAM_FLOAT_OVERRIDE(Name, MemberName, ValueType) + + Where: + Name - The name of the param that will be used for reflection and appended to setters and getters, for example Width + MemberName - The name of the member defined inside your class, for example m_width + ValueType - The type of the parameter you defined (bool, float, uint32_t, Vector2 etc.) + + A bit more details on each of the override macros: + + AZ_GFX_ANY_PARAM_BOOL_OVERRIDE can be used for params of any type. The override variable will be a bool (checkbox in the UI). + The override application is a simple binary operation: take all of the source or the target (no lerp) depending on the bool. + + AZ_GFX_INTEGER_PARAM_FLOAT_OVERRIDE should be used for params of integer types (int, uint, integer vectors...) The override variable + will be a float from 0.0 to 1.0 (slider in the UI). The override will lerp between target and source using the override float + variable. Note that for this reason the param integer type must support multiplication by a float value. + + AZ_GFX_FLOAT_PARAM_FLOAT_OVERRIDE should be used for params of floating point types (float, double, Vector4...) The override variable + will be a float from 0.0 to 1.0 (slider in the UI). The override will lerp between target and source using the override float. + + Example usage: + + #define AZ_GFX_VEC3_PARAM(Position, m_position, Vector3(0.0f, 0.0f, 0.0f)) + #define AZ_GFX_FLOAT_PARAM_FLOAT_OVERRIDE(Position, m_position, Vector3) + + ___________________________________________________________________________________________________________________________________________________ + + Part V: Defining functionality with .inl files + + There are many .inl fies in this folder that provide pre-defined behaviors for params declared with the above macros + To use these files, start by including the .inl file that specifies the behavior, then include your own .inl that defines your params + then include EndParams.inl (this will #undef all used macros so as to avoid collisions with subsequent macro usage further in the file) + + Here is an example of how that looks: + + #include <- The behavior you want (behavior is described in each file) + #include <- Your file in which you declare your params + #include <- This #undef a bunch of macros to avoid conflicts + + You may of course use your own custom behaviors by specifying your definition for the param and override macros. + You can specify each macro individually (AZ_GFX_BOOL_PARAM, AZ_GFX_FLOAT_PARAM, AZ_GFX_UINT32_PARAM, AZ_GFX_VEC2_PARAM, etc.) + or you can specify the AZ_GFX_COMMON_PARAM and AZ_GFX_COMMON_OVERRIDE macros if there's no difference between variable types. + + AZ_GFX_COMMON_PARAM and AZ_GFX_COMMON_OVERRIDE are helper macros that the other _PARAM and _OVERRIDE macros can be mapped to + using MapAllCommon.inl, allowing you to specify one definition for all types rather than each type individually. + Here is an example of how we can use AZ_GFX_COMMON_PARAM and AZ_GFX_COMMON_OVERRIDE to auto-generate getters for our member parameters: + + #define AZ_GFX_COMMON_PARAM(Name, MemberName, DefaultValue, ValueType) \ + ValueType Get##Name() const override { return MemberName; } \ + + #define AZ_GFX_COMMON_OVERRIDE(Name, MemberName, ValueType, OverrideValueType) \ + OverrideValueType Get##Name##Override() const override { return MemberName##Override; } \ + + #include + #include + #include + +*/ diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp index 81d773d8c0..cbdb99a008 100644 --- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp @@ -976,14 +976,14 @@ namespace UnitTest EXPECT_EQ(uvStreamTangentBitmask.GetFullTangentBitmask(), 0x70000F51); } - // - // +----+ - // / /| - // +----+ | - // | | + - // | |/ - // +----+ - // + /* + +----+ + / /| + +----+ | + | | + + | |/ + +----+ + */ static constexpr AZStd::array CubePositions = { -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f }; static constexpr AZStd::array CubeIndices = { @@ -993,23 +993,25 @@ namespace UnitTest static constexpr AZStd::array QuadPositions = { -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f }; static constexpr AZStd::array QuadIndices = { uint32_t{ 0 }, 2, 1, 1, 2, 3 }; - // This class creates a Model with one LOD, whose mesh contains 2 planes. Plane 1 is in the XY plane at Z=-0.5, and - // plane 2 is in the XY plane at Z=0.5. The two planes each have 9 quads which have been triangulated. It only has - // a position and index buffer. - // - // -0.33 - // -1 0.33 1 - // 0.5 *---*---*---* - // \ / \ / \ / \ - // *---*---*---* - // \ / \ / \ / \ - // -0.5 *- *---*---*---* - // \ \ / \ / \ / \ - // *- *---*---*---* - // \ \ \ \ - // *---*---*---* - // \ / \ / \ / \ - // *---*---*---* + /* + This class creates a Model with one LOD, whose mesh contains 2 planes. Plane 1 is in the XY plane at Z=-0.5, and + plane 2 is in the XY plane at Z=0.5. The two planes each have 9 quads which have been triangulated. It only has + a position and index buffer. + + -0.33 + -1 0.33 1 + 0.5 *---*---*---* + \ / \ / \ / \ + *---*---*---* + \ / \ / \ / \ + -0.5 *- *---*---*---* + \ \ / \ / \ / \ + *- *---*---*---* + \ \ \ \ + *---*---*---* + \ / \ / \ / \ + *---*---*---* + */ static constexpr AZStd::array TwoSeparatedPlanesPositions{ -1.0f, -0.333f, -0.5f, -0.333f, -1.0f, -0.5f, -0.333f, -0.333f, -0.5f, 0.333f, -0.333f, -0.5f, 1.0f, -1.0f, -0.5f, 1.0f, -0.333f, -0.5f, 0.333f, -1.0f, -0.5f, 0.333f, 1.0f, -0.5f, 1.0f, 0.333f, -0.5f, 1.0f, 1.0f, -0.5f, diff --git a/Gems/Atom/RPI/Code/Tests/Shader/ShaderTests.cpp b/Gems/Atom/RPI/Code/Tests/Shader/ShaderTests.cpp index 74f79ad80a..b30fd0ec94 100644 --- a/Gems/Atom/RPI/Code/Tests/Shader/ShaderTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Shader/ShaderTests.cpp @@ -1666,20 +1666,21 @@ namespace UnitTest EXPECT_FALSE(result7.IsFullyBaked()); EXPECT_EQ(result7.GetStableId().GetIndex(), stableId7); - // All searches so far found exactly the node we were looking for - // The next couple of searches will not find the requested node - // and will instead default to its parent, up the tree to the root - // - // [] [Root] - // / \ - // [Color] [Teal] [Fuchsia] - // / \ - // [Quality] [Sublime] [Auto] - // / - // [NumberSamples] [50] - // / \ - // [Raytracing] [On] [Off] - + /* + All searches so far found exactly the node we were looking for + The next couple of searches will not find the requested node + and will instead default to its parent, up the tree to the root + + [] [Root] + / \ + [Color] [Teal] [Fuchsia] + / \ + [Quality] [Sublime] [Auto] + / + [NumberSamples] [50] + / \ + [Raytracing] [On] [Off] + */ // ---------------------------------------- // [Quality::Poor] diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp index 23e5d25824..7f909e0e5f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp @@ -1634,19 +1634,19 @@ namespace MCommon AZ::Vector3 vertices[7]; /* - // 4 - // / \ - // / \ - // / \ - // / \ - // / \ - // 5-----6 2-----3 - // | | - // | | - // | | - // | | - // | | - // 0---------1 + 4 + / \ + / \ + / \ + / \ + / \ + 5-----6 2-----3 + | | + | | + | | + | | + | | + 0---------1 */ // construct the arrow vertices vertices[0] = center + AZ::Vector3(-right * trailWidthHalf - forward * trailLengh) * scale; @@ -1744,19 +1744,19 @@ namespace MCommon AZ::Vector3 oldLeft, oldRight; /* - // 4 - // / \ - // / \ - // / \ - // / \ - // / \ - // 5-----6 2-----3 - // | | - // | | - // | | - // | | - // | | - // 0-------1 + 4 + / \ + / \ + / \ + / \ + / \ + 5-----6 2-----3 + | | + | | + | | + | | + | | + 0-------1 */ // construct the arrow vertices vertices[0] = center + (-right * trailWidthHalf - forward * trailLength) * scale; diff --git a/Gems/EMotionFX/Code/Tests/AutoSkeletonLODTests.cpp b/Gems/EMotionFX/Code/Tests/AutoSkeletonLODTests.cpp index 726aa664f0..d445bc62e0 100644 --- a/Gems/EMotionFX/Code/Tests/AutoSkeletonLODTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AutoSkeletonLODTests.cpp @@ -31,23 +31,25 @@ namespace EMotionFX class AutoSkeletonLODActor : public SimpleJointChainActor { - // This creates an Actor with following hierarchy. - // The numbers are the joint indices. - // - // 5 - // / - // / - // 0-----1-----2-----3-----4 - // \ - // \ - // 6 - // - // 7 (a node with skinned mesh) - // - // The mesh is on node 7, which is also a root node, just like joint number 0. - // We (fake) skin the first six joints to the mesh of node 7. - // Our test will actually skin to only a selection of these first seven joints. - // We then test which joints get disabled and which not. + /* + This creates an Actor with following hierarchy. + The numbers are the joint indices. + + 5 + / + / + 0-----1-----2-----3-----4 + \ + \ + 6 + + 7 (a node with skinned mesh) + + The mesh is on node 7, which is also a root node, just like joint number 0. + We (fake) skin the first six joints to the mesh of node 7. + Our test will actually skin to only a selection of these first seven joints. + We then test which joints get disabled and which not. + */ public: explicit AutoSkeletonLODActor(AZ::u32 numSubMeshJoints) : SimpleJointChainActor(5) diff --git a/Gems/EMotionFX/Code/Tests/BlendSpaceTests.cpp b/Gems/EMotionFX/Code/Tests/BlendSpaceTests.cpp index b2f6f49d8f..ce8387f150 100644 --- a/Gems/EMotionFX/Code/Tests/BlendSpaceTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendSpaceTests.cpp @@ -254,19 +254,21 @@ namespace EMotionFX EXPECT_EQ(motions.size(), 4); EXPECT_EQ(uniqueData->m_triangles.size(), 2); - // run 2 * - // |\ - // | \ - // | \ - // | \ - // | \ - // forward 1 * * 3 Strafe - // | / - // | / - // | / - // | / - // |/ - // idle 0 * + /* + run 2 * + |\ + | \ + | \ + | \ + | \ + forward 1 * * 3 Strafe + | / + | / + | / + | / + |/ + idle 0 * + */ EXPECT_EQ(uniqueData->m_triangles[0], BlendSpace2DNode::Triangle(1, 0, 3)); EXPECT_EQ(uniqueData->m_triangles[1], BlendSpace2DNode::Triangle(2, 1, 3)); } diff --git a/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp b/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp index 09a4e46b84..cc3e3c344a 100644 --- a/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp +++ b/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp @@ -285,12 +285,14 @@ namespace EMotionFX numRemoved = motionData.ReduceSamples(reduceSettings); EXPECT_EQ(motionData.GetNumFloatSamples(0), 2); EXPECT_EQ(numRemoved, 9); - - // Set the sample in the middle to 1.0 and the rest to 0. - // - // /\ - // / \ - // ---------------------/ \--------------------- + + /* + Set the sample in the middle to 1.0 and the rest to 0. + + /\ + / \ + ---------------------/ \--------------------- + */ motionData.AllocateFloatSamples(0, 11); for (size_t i = 0; i < motionData.GetNumFloatSamples(0); ++i) { @@ -301,12 +303,14 @@ namespace EMotionFX numRemoved = motionData.ReduceSamples(reduceSettings); EXPECT_EQ(motionData.GetNumFloatSamples(0), 5); EXPECT_EQ(numRemoved, 6); - - // Make a bump of 2 frames. - // - // /------\ - // / \ - // ---------------------/ \--------------- + + /* + Make a bump of 2 frames. + + /------\ + / \ + ---------------------/ \--------------- + */ motionData.AllocateFloatSamples(0, 11); for (size_t i = 0; i < motionData.GetNumFloatSamples(0); ++i) { @@ -398,11 +402,13 @@ namespace EMotionFX EXPECT_EQ(motionData.GetNumJointRotationSamples(0), 0); EXPECT_EQ(numRemoved, 11); - // Set the sample in the middle to 1.0 and the rest to 0. - // - // /\ - // / \ - // ---------------------/ \--------------------- + /* + Set the sample in the middle to 1.0 and the rest to 0. + + /\ + / \ + ---------------------/ \--------------------- + */ motionData.AllocateJointRotationSamples(0, 11); for (size_t i = 0; i < motionData.GetNumJointRotationSamples(0); ++i) { @@ -413,12 +419,14 @@ namespace EMotionFX numRemoved = motionData.ReduceSamples(reduceSettings); EXPECT_EQ(motionData.GetNumJointRotationSamples(0), 5); EXPECT_EQ(numRemoved, 6); - - // Make a bump of 2 frames. - // - // /------\ - // / \ - // ---------------------/ \--------------- + + /* + Make a bump of 2 frames. + + /------\ + / \ + ---------------------/ \--------------- + */ motionData.AllocateJointRotationSamples(0, 11); for (size_t i = 0; i < motionData.GetNumJointRotationSamples(0); ++i) { @@ -509,11 +517,13 @@ namespace EMotionFX EXPECT_EQ(motionData.GetNumJointPositionSamples(0), 0); EXPECT_EQ(numRemoved, 11); - // Set the sample in the middle to 1.0 and the rest to 0. - // - // /\ - // / \ - // ---------------------/ \--------------------- + /* + Set the sample in the middle to 1.0 and the rest to 0. + + /\ + / \ + ---------------------/ \--------------------- + */ motionData.AllocateJointPositionSamples(0, 11); for (size_t i = 0; i < motionData.GetNumJointPositionSamples(0); ++i) { @@ -525,11 +535,13 @@ namespace EMotionFX EXPECT_EQ(motionData.GetNumJointPositionSamples(0), 5); EXPECT_EQ(numRemoved, 6); - // Make a bump of 2 frames. - // - // /------\ - // / \ - // ---------------------/ \--------------- + /* + Make a bump of 2 frames. + + /------\ + / \ + ---------------------/ \--------------- + */ motionData.AllocateJointPositionSamples(0, 11); for (size_t i = 0; i < motionData.GetNumJointPositionSamples(0); ++i) { diff --git a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp index 68198c491a..6dc6bf3f18 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp @@ -328,18 +328,19 @@ namespace LmbrCentral sides, capSegments, vertices); } } - - /// Generates vertices and indices for a tube shape - /// Split into two stages: - /// - Generate vertex positions - /// - Generate indices (faces) - /// Heres a rough diagram of how it is built: - /// ____________ - /// /_|__|__|__|_\ - /// \_|__|__|__|_/ - /// - A single vertex at each end of the tube - /// - Angled end cap segments - /// - Middle segments + /* + Generates vertices and indices for a tube shape + Split into two stages: + - Generate vertex positions + - Generate indices (faces) + Heres a rough diagram of how it is built: + ____________ + /_|__|__|__|_\ + \_|__|__|__|_/ + - A single vertex at each end of the tube + - Angled end cap segments + - Middle segments + */ void GenerateSolidTubeMesh( const AZ::SplinePtr& spline, const SplineAttribute& variableRadius, const float radius, const AZ::u32 capSegments, const AZ::u32 sides, diff --git a/cmake/Platform/Common/GCC/Configurations_gcc.cmake b/cmake/Platform/Common/GCC/Configurations_gcc.cmake index 9963c62d39..12dd4d7bdd 100644 --- a/cmake/Platform/Common/GCC/Configurations_gcc.cmake +++ b/cmake/Platform/Common/GCC/Configurations_gcc.cmake @@ -34,7 +34,6 @@ ly_append_configurations_options( -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden - -Wall -Werror @@ -45,7 +44,6 @@ ly_append_configurations_options( -Wno-array-bounds -Wno-attributes -Wno-class-memaccess - -Wno-comment -Wno-delete-non-virtual-dtor -Wno-enum-compare -Wno-format-overflow