diff --git a/Source/Engine/Core/Types/CommonValue.h b/Source/Engine/Core/Types/CommonValue.h index 91e468a20..a233610bd 100644 --- a/Source/Engine/Core/Types/CommonValue.h +++ b/Source/Engine/Core/Types/CommonValue.h @@ -425,225 +425,6 @@ public: return *this; } - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const bool value) - { - SetType(CommonType::Bool); - AsBool = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const int32 value) - { - SetType(CommonType::Integer); - AsInteger = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const float value) - { - SetType(CommonType::Float); - AsFloat = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Vector2& value) - { - SetType(CommonType::Vector2); - AsVector2 = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Vector3& value) - { - SetType(CommonType::Vector3); - AsVector3 = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Vector4& value) - { - SetType(CommonType::Vector4); - AsVector4 = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Color& value) - { - SetType(CommonType::Color); - AsColor = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Matrix& value) - { - SetType(CommonType::Matrix); - AsMatrix = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Guid& value) - { - SetType(CommonType::Guid); - AsGuid = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const String& value) - { - Set(value); - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const StringView& value) - { - Set(value); - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const BoundingBox& value) - { - SetType(CommonType::Box); - AsBox = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Quaternion& value) - { - SetType(CommonType::Rotation); - AsRotation = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Transform& value) - { - SetType(CommonType::Transform); - AsTransform = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const BoundingSphere& value) - { - SetType(CommonType::Sphere); - AsSphere = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Rectangle& value) - { - SetType(CommonType::Rectangle); - AsRectangle = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Ray& value) - { - SetType(CommonType::Ray); - AsRay = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(const Char* value) - { - Set(StringView(value)); - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(void* value) - { - SetType(CommonType::Pointer); - AsPointer = value; - return *this; - } - - /// - /// Assignment operator - /// - /// Value - CommonValue& operator=(ScriptingObject* value) - { - SetType(CommonType::Object); - AsObject = value; - if (value) - LinkObject(); - return *this; - } - public: /// diff --git a/Source/Engine/Foliage/Config.h b/Source/Engine/Foliage/Config.h index 8f93a2015..2692adf01 100644 --- a/Source/Engine/Foliage/Config.h +++ b/Source/Engine/Foliage/Config.h @@ -2,7 +2,6 @@ #pragma once -// Forward declarations class Foliage; class FoliageCluster; class FoliageType; diff --git a/Source/Engine/Foliage/Foliage.cpp b/Source/Engine/Foliage/Foliage.cpp index aef2da3dd..497ffd208 100644 --- a/Source/Engine/Foliage/Foliage.cpp +++ b/Source/Engine/Foliage/Foliage.cpp @@ -492,10 +492,8 @@ void Foliage::DrawCluster(RenderContext& renderContext, FoliageCluster* cluster, // Draw visible children if (cluster->Children[0]) { -#if BUILD_DEBUG // Don't store instances in non-leaf nodes - ASSERT(cluster->Instances.IsEmpty()); -#endif + ASSERT_LOW_LAYER(cluster->Instances.IsEmpty()); #define DRAW_CLUSTER(idx) \ if (renderContext.View.CullingFrustum.Intersects(cluster->Children[idx]->TotalBounds)) \ diff --git a/Source/Engine/Foliage/FoliageInstance.h b/Source/Engine/Foliage/FoliageInstance.h index a11a6212d..a4dd2b25b 100644 --- a/Source/Engine/Foliage/FoliageInstance.h +++ b/Source/Engine/Foliage/FoliageInstance.h @@ -64,7 +64,6 @@ public: /// /// Determines whether this foliage instance has valid lightmap data. /// - /// true if this foliage instance has valid lightmap data; otherwise, false. FORCE_INLINE bool HasLightmap() const { return Lightmap.TextureIndex != INVALID_INDEX; diff --git a/Source/Engine/Foliage/FoliageType.h b/Source/Engine/Foliage/FoliageType.h index 6a84abb1a..ebe48a513 100644 --- a/Source/Engine/Foliage/FoliageType.h +++ b/Source/Engine/Foliage/FoliageType.h @@ -206,7 +206,6 @@ public: /// /// Determines whether this instance is ready (model is loaded). /// - /// true if foliage type model is loaded and instance type is ready; otherwise, false. FORCE_INLINE bool IsReady() const { return _isReady != 0; @@ -215,7 +214,6 @@ public: /// /// Gets the random scale for the foliage instance of this type. /// - /// The scale vector. Vector3 GetRandomScale() const; private: diff --git a/Source/Engine/Level/Scene/SceneRendering.cpp b/Source/Engine/Level/Scene/SceneRendering.cpp index dce13814b..86f2f7124 100644 --- a/Source/Engine/Level/Scene/SceneRendering.cpp +++ b/Source/Engine/Level/Scene/SceneRendering.cpp @@ -18,10 +18,10 @@ ALIGN_BEGIN(16) struct CullDataSIMD { - float xs[8]; - float ys[8]; - float zs[8]; - float ds[8]; + float xs[8]; + float ys[8]; + float zs[8]; + float ds[8]; } ALIGN_END(16); #endif @@ -70,100 +70,106 @@ void SceneRendering::DrawEntries::CullAndDraw(RenderContext& renderContext) auto& view = renderContext.View; const BoundingFrustum frustum = view.CullingFrustum; #if SCENE_RENDERING_USE_SIMD - CullDataSIMD cullData; - { - // Near - auto plane = view.Frustum.GetNear(); - cullData.xs[0] = plane.Normal.X; - cullData.ys[0] = plane.Normal.Y; - cullData.zs[0] = plane.Normal.Z; - cullData.ds[0] = plane.D; + CullDataSIMD cullData; + { + // Near + auto plane = view.Frustum.GetNear(); + cullData.xs[0] = plane.Normal.X; + cullData.ys[0] = plane.Normal.Y; + cullData.zs[0] = plane.Normal.Z; + cullData.ds[0] = plane.D; - // Far - plane = view.Frustum.GetFar(); - cullData.xs[1] = plane.Normal.X; - cullData.ys[1] = plane.Normal.Y; - cullData.zs[1] = plane.Normal.Z; - cullData.ds[1] = plane.D; + // Far + plane = view.Frustum.GetFar(); + cullData.xs[1] = plane.Normal.X; + cullData.ys[1] = plane.Normal.Y; + cullData.zs[1] = plane.Normal.Z; + cullData.ds[1] = plane.D; - // Left - plane = view.Frustum.GetLeft(); - cullData.xs[2] = plane.Normal.X; - cullData.ys[2] = plane.Normal.Y; - cullData.zs[2] = plane.Normal.Z; - cullData.ds[2] = plane.D; + // Left + plane = view.Frustum.GetLeft(); + cullData.xs[2] = plane.Normal.X; + cullData.ys[2] = plane.Normal.Y; + cullData.zs[2] = plane.Normal.Z; + cullData.ds[2] = plane.D; - // Right - plane = view.Frustum.GetRight(); - cullData.xs[3] = plane.Normal.X; - cullData.ys[3] = plane.Normal.Y; - cullData.zs[3] = plane.Normal.Z; - cullData.ds[3] = plane.D; + // Right + plane = view.Frustum.GetRight(); + cullData.xs[3] = plane.Normal.X; + cullData.ys[3] = plane.Normal.Y; + cullData.zs[3] = plane.Normal.Z; + cullData.ds[3] = plane.D; - // Top - plane = view.Frustum.GetTop(); - cullData.xs[4] = plane.Normal.X; - cullData.ys[4] = plane.Normal.Y; - cullData.zs[4] = plane.Normal.Z; - cullData.ds[4] = plane.D; + // Top + plane = view.Frustum.GetTop(); + cullData.xs[4] = plane.Normal.X; + cullData.ys[4] = plane.Normal.Y; + cullData.zs[4] = plane.Normal.Z; + cullData.ds[4] = plane.D; - // Bottom - plane = view.Frustum.GetBottom(); - cullData.xs[5] = plane.Normal.X; - cullData.ys[5] = plane.Normal.Y; - cullData.zs[5] = plane.Normal.Z; - cullData.ds[5] = plane.D; + // Bottom + plane = view.Frustum.GetBottom(); + cullData.xs[5] = plane.Normal.X; + cullData.ys[5] = plane.Normal.Y; + cullData.zs[5] = plane.Normal.Z; + cullData.ds[5] = plane.D; - // Extra 0 - cullData.xs[6] = 0; - cullData.ys[6] = 0; - cullData.zs[6] = 0; - cullData.ds[6] = 0; + // Extra 0 + cullData.xs[6] = 0; + cullData.ys[6] = 0; + cullData.zs[6] = 0; + cullData.ds[6] = 0; - // Extra 1 - cullData.xs[7] = 0; - cullData.ys[7] = 0; - cullData.zs[7] = 0; - cullData.ds[7] = 0; - } + // Extra 1 + cullData.xs[7] = 0; + cullData.ys[7] = 0; + cullData.zs[7] = 0; + cullData.ds[7] = 0; + } - float4 px = SIMD::Load(cullData.xs); - float4 py = SIMD::Load(cullData.ys); - float4 pz = SIMD::Load(cullData.zs); - float4 pd = SIMD::Load(cullData.ds); - float4 px2 = SIMD::Load(&cullData.xs[4]); - float4 py2 = SIMD::Load(&cullData.ys[4]); - float4 pz2 = SIMD::Load(&cullData.zs[4]); - float4 pd2 = SIMD::Load(&cullData.ds[4]); + SimdVector4 px = SIMD::Load(cullData.xs); + SimdVector4 py = SIMD::Load(cullData.ys); + SimdVector4 pz = SIMD::Load(cullData.zs); + SimdVector4 pd = SIMD::Load(cullData.ds); + SimdVector4 px2 = SIMD::Load(&cullData.xs[4]); + SimdVector4 py2 = SIMD::Load(&cullData.ys[4]); + SimdVector4 pz2 = SIMD::Load(&cullData.zs[4]); + SimdVector4 pd2 = SIMD::Load(&cullData.ds[4]); - for (int32 i = 0; i < List.Count(); i++) - { - auto& e = List[i]; + for (int32 i = 0; i < List.Count(); i++) + { + auto e = List[i]; - const auto& sphere = actors[i]->GetSphere(); - float4 cx = SIMD::Splat(sphere.Center.X); - float4 cy = SIMD::Splat(sphere.Center.Y); - float4 cz = SIMD::Splat(sphere.Center.Z); - float4 r = SIMD::Splat(-sphere.Radius); + SimdVector4 cx = SIMD::Splat(e.Bounds.Center.X); + SimdVector4 cy = SIMD::Splat(e.Bounds.Center.Y); + SimdVector4 cz = SIMD::Splat(e.Bounds.Center.Z); + SimdVector4 r = SIMD::Splat(-e.Bounds.Radius); - float4 t = SIMD::Mul(cx, px); - t = SIMD::Add(t, SIMD::Mul(cy, py)); - t = SIMD::Add(t, SIMD::Mul(cz, pz)); - t = SIMD::Add(t, pd); - t = SIMD::Sub(t, r); - if (SIMD::MoveMask(t)) - continue; + SimdVector4 t = SIMD::Mul(cx, px); + t = SIMD::Add(t, SIMD::Mul(cy, py)); + t = SIMD::Add(t, SIMD::Mul(cz, pz)); + t = SIMD::Add(t, pd); + t = SIMD::Sub(t, r); + if (SIMD::MoveMask(t)) + continue; - t = SIMD::Mul(cx, px2); - t = SIMD::Add(t, SIMD::Mul(cy, py2)); - t = SIMD::Add(t, SIMD::Mul(cz, pz2)); - t = SIMD::Add(t, pd2); - t = SIMD::Sub(t, r); - if (SIMD::MoveMask(t)) - continue; + t = SIMD::Mul(cx, px2); + t = SIMD::Add(t, SIMD::Mul(cy, py2)); + t = SIMD::Add(t, SIMD::Mul(cz, pz2)); + t = SIMD::Add(t, pd2); + t = SIMD::Sub(t, r); + if (SIMD::MoveMask(t)) + continue; - e.Actor->Draw(renderContext); - } + if (view.RenderLayersMask.Mask & e.LayerMask) + { +#if SCENE_RENDERING_USE_PROFILER + PROFILE_CPU(); + ___tracy_scoped_zone.Name(*e.Actor->GetName(), e.Actor->GetName().Length()); +#endif + e.Actor->Draw(renderContext); + } + } #else for (int32 i = 0; i < List.Count(); i++) { @@ -185,99 +191,106 @@ void SceneRendering::DrawEntries::CullAndDrawOffline(RenderContext& renderContex auto& view = renderContext.View; const BoundingFrustum frustum = view.CullingFrustum; #if SCENE_RENDERING_USE_SIMD - CullDataSIMD cullData; - { - // Near - auto plane = view.Frustum.GetNear(); - cullData.xs[0] = plane.Normal.X; - cullData.ys[0] = plane.Normal.Y; - cullData.zs[0] = plane.Normal.Z; - cullData.ds[0] = plane.D; + CullDataSIMD cullData; + { + // Near + auto plane = view.Frustum.GetNear(); + cullData.xs[0] = plane.Normal.X; + cullData.ys[0] = plane.Normal.Y; + cullData.zs[0] = plane.Normal.Z; + cullData.ds[0] = plane.D; - // Far - plane = view.Frustum.GetFar(); - cullData.xs[1] = plane.Normal.X; - cullData.ys[1] = plane.Normal.Y; - cullData.zs[1] = plane.Normal.Z; - cullData.ds[1] = plane.D; + // Far + plane = view.Frustum.GetFar(); + cullData.xs[1] = plane.Normal.X; + cullData.ys[1] = plane.Normal.Y; + cullData.zs[1] = plane.Normal.Z; + cullData.ds[1] = plane.D; - // Left - plane = view.Frustum.GetLeft(); - cullData.xs[2] = plane.Normal.X; - cullData.ys[2] = plane.Normal.Y; - cullData.zs[2] = plane.Normal.Z; - cullData.ds[2] = plane.D; + // Left + plane = view.Frustum.GetLeft(); + cullData.xs[2] = plane.Normal.X; + cullData.ys[2] = plane.Normal.Y; + cullData.zs[2] = plane.Normal.Z; + cullData.ds[2] = plane.D; - // Right - plane = view.Frustum.GetRight(); - cullData.xs[3] = plane.Normal.X; - cullData.ys[3] = plane.Normal.Y; - cullData.zs[3] = plane.Normal.Z; - cullData.ds[3] = plane.D; + // Right + plane = view.Frustum.GetRight(); + cullData.xs[3] = plane.Normal.X; + cullData.ys[3] = plane.Normal.Y; + cullData.zs[3] = plane.Normal.Z; + cullData.ds[3] = plane.D; - // Top - plane = view.Frustum.GetTop(); - cullData.xs[4] = plane.Normal.X; - cullData.ys[4] = plane.Normal.Y; - cullData.zs[4] = plane.Normal.Z; - cullData.ds[4] = plane.D; + // Top + plane = view.Frustum.GetTop(); + cullData.xs[4] = plane.Normal.X; + cullData.ys[4] = plane.Normal.Y; + cullData.zs[4] = plane.Normal.Z; + cullData.ds[4] = plane.D; - // Bottom - plane = view.Frustum.GetBottom(); - cullData.xs[5] = plane.Normal.X; - cullData.ys[5] = plane.Normal.Y; - cullData.zs[5] = plane.Normal.Z; - cullData.ds[5] = plane.D; + // Bottom + plane = view.Frustum.GetBottom(); + cullData.xs[5] = plane.Normal.X; + cullData.ys[5] = plane.Normal.Y; + cullData.zs[5] = plane.Normal.Z; + cullData.ds[5] = plane.D; - // Extra 0 - cullData.xs[6] = 0; - cullData.ys[6] = 0; - cullData.zs[6] = 0; - cullData.ds[6] = 0; + // Extra 0 + cullData.xs[6] = 0; + cullData.ys[6] = 0; + cullData.zs[6] = 0; + cullData.ds[6] = 0; - // Extra 1 - cullData.xs[7] = 0; - cullData.ys[7] = 0; - cullData.zs[7] = 0; - cullData.ds[7] = 0; - } + // Extra 1 + cullData.xs[7] = 0; + cullData.ys[7] = 0; + cullData.zs[7] = 0; + cullData.ds[7] = 0; + } - float4 px = SIMD::Load(cullData.xs); - float4 py = SIMD::Load(cullData.ys); - float4 pz = SIMD::Load(cullData.zs); - float4 pd = SIMD::Load(cullData.ds); - float4 px2 = SIMD::Load(&cullData.xs[4]); - float4 py2 = SIMD::Load(&cullData.ys[4]); - float4 pz2 = SIMD::Load(&cullData.zs[4]); - float4 pd2 = SIMD::Load(&cullData.ds[4]); + SimdVector4 px = SIMD::Load(cullData.xs); + SimdVector4 py = SIMD::Load(cullData.ys); + SimdVector4 pz = SIMD::Load(cullData.zs); + SimdVector4 pd = SIMD::Load(cullData.ds); + SimdVector4 px2 = SIMD::Load(&cullData.xs[4]); + SimdVector4 py2 = SIMD::Load(&cullData.ys[4]); + SimdVector4 pz2 = SIMD::Load(&cullData.zs[4]); + SimdVector4 pd2 = SIMD::Load(&cullData.ds[4]); - for (int32 i = 0; i < actors.Count(); i++) - { - const auto& sphere = actors[i]->GetSphere(); - float4 cx = SIMD::Splat(sphere.Center.X); - float4 cy = SIMD::Splat(sphere.Center.Y); - float4 cz = SIMD::Splat(sphere.Center.Z); - float4 r = SIMD::Splat(-sphere.Radius); + for (int32 i = 0; i < List.Count(); i++) + { + auto e = List[i]; - float4 t = SIMD::Mul(cx, px); - t = SIMD::Add(t, SIMD::Mul(cy, py)); - t = SIMD::Add(t, SIMD::Mul(cz, pz)); - t = SIMD::Add(t, pd); - t = SIMD::Sub(t, r); - if (SIMD::MoveMask(t)) - continue; + SimdVector4 cx = SIMD::Splat(e.Bounds.Center.X); + SimdVector4 cy = SIMD::Splat(e.Bounds.Center.Y); + SimdVector4 cz = SIMD::Splat(e.Bounds.Center.Z); + SimdVector4 r = SIMD::Splat(-e.Bounds.Radius); - t = SIMD::Mul(cx, px2); - t = SIMD::Add(t, SIMD::Mul(cy, py2)); - t = SIMD::Add(t, SIMD::Mul(cz, pz2)); - t = SIMD::Add(t, pd2); - t = SIMD::Sub(t, r); - if (SIMD::MoveMask(t)) - continue; + SimdVector4 t = SIMD::Mul(cx, px); + t = SIMD::Add(t, SIMD::Mul(cy, py)); + t = SIMD::Add(t, SIMD::Mul(cz, pz)); + t = SIMD::Add(t, pd); + t = SIMD::Sub(t, r); + if (SIMD::MoveMask(t)) + continue; - if (actors[i]->GetStaticFlags() & renderContext.View.StaticFlagsMask) - actors[i]->Draw(renderContext); - } + t = SIMD::Mul(cx, px2); + t = SIMD::Add(t, SIMD::Mul(cy, py2)); + t = SIMD::Add(t, SIMD::Mul(cz, pz2)); + t = SIMD::Add(t, pd2); + t = SIMD::Sub(t, r); + if (SIMD::MoveMask(t)) + continue; + + if (view.RenderLayersMask.Mask & e.LayerMask && e.Actor->GetStaticFlags() & renderContext.View.StaticFlagsMask) + { +#if SCENE_RENDERING_USE_PROFILER + PROFILE_CPU(); + ___tracy_scoped_zone.Name(*e.Actor->GetName(), e.Actor->GetName().Length()); +#endif + e.Actor->Draw(renderContext); + } + } #else for (int32 i = 0; i < List.Count(); i++) { diff --git a/Source/Engine/Renderer/RenderList.cpp b/Source/Engine/Renderer/RenderList.cpp index b92985a8f..f387f5085 100644 --- a/Source/Engine/Renderer/RenderList.cpp +++ b/Source/Engine/Renderer/RenderList.cpp @@ -361,8 +361,6 @@ void RenderList::Clear() void RenderList::AddDrawCall(DrawPass drawModes, StaticFlags staticFlags, DrawCall& drawCall, bool receivesDecals) { - ASSERT_LOW_LAYER(drawCall.Geometry.IndexBuffer); - // Mix object mask with material mask const auto mask = (DrawPass)(drawModes & drawCall.Material->GetDrawModes()); if (mask == DrawPass::None)