Minor improvements

This commit is contained in:
Wojciech Figat
2022-04-19 17:15:54 +02:00
parent c53a463bb1
commit b9652949b0
5 changed files with 14 additions and 12 deletions

BIN
Content/Shaders/GlobalSurfaceAtlas.flax (Stored with Git LFS)

Binary file not shown.

View File

@@ -26,6 +26,9 @@ API_CLASS() class FLAXENGINE_API RenderBuffers : public ScriptingObject
{
DECLARE_SCRIPTING_TYPE(RenderBuffers);
/// <summary>
/// The custom rendering state.
/// </summary>
class CustomBuffer : public Object
{
public:

View File

@@ -289,7 +289,8 @@ void SceneRenderTask::OnCollectDrawCalls(RenderContext& renderContext)
{
if (_customActorsScene == nullptr)
_customActorsScene = New<SceneRendering>();
_customActorsScene->Clear();
else
_customActorsScene->Clear();
for (Actor* a : CustomActors)
AddActorToSceneRendering(_customActorsScene, a);
_customActorsScene->Draw(renderContext);
@@ -414,7 +415,7 @@ void SceneRenderTask::OnEnd(GPUContext* context)
// Swap matrices
View.PrevView = View.View;
View.PrevProjection = View.Projection;
Matrix::Multiply(View.PrevView, View.PrevProjection, View.PrevViewProjection);
View.PrevViewProjection = View.ViewProjection();
}
bool SceneRenderTask::Resize(int32 width, int32 height)

View File

@@ -25,10 +25,7 @@ void SceneRendering::Draw(RenderContext& renderContext)
if (view.RenderLayersMask.Mask & e.LayerMask && (e.NoCulling || frustum.Intersects(e.Bounds)) && e.Actor->GetStaticFlags() & view.StaticFlagsMask)
{
#if SCENE_RENDERING_USE_PROFILER
PROFILE_CPU();
#if TRACY_ENABLE
___tracy_scoped_zone.Name(*e.Actor->GetName(), e.Actor->GetName().Length());
#endif
PROFILE_CPU_ACTOR(e.Actor);
#endif
e.Actor->Draw(renderContext);
}
@@ -42,10 +39,7 @@ void SceneRendering::Draw(RenderContext& renderContext)
if (view.RenderLayersMask.Mask & e.LayerMask && (e.NoCulling || frustum.Intersects(e.Bounds)))
{
#if SCENE_RENDERING_USE_PROFILER
PROFILE_CPU();
#if TRACY_ENABLE
___tracy_scoped_zone.Name(*e.Actor->GetName(), e.Actor->GetName().Length());
#endif
PROFILE_CPU_ACTOR(e.Actor);
#endif
e.Actor->Draw(renderContext);
}
@@ -88,6 +82,7 @@ void SceneRendering::Clear()
int32 SceneRendering::AddActor(Actor* a)
{
int32 key = 0;
// TODO: track removedCount and skip searching for free entry if there is none
for (; key < Actors.Count(); key++)
{
if (Actors[key].Actor == nullptr)

View File

@@ -403,9 +403,11 @@ struct TIsPODType<ProfilerCPU::Event>
#ifdef TRACY_ENABLE
#define PROFILE_CPU_SRC_LOC(srcLoc) tracy::ScopedZone ___tracy_scoped_zone( (tracy::SourceLocationData*)&(srcLoc) ); ScopeProfileBlockCPU ProfileBlockCPU((srcLoc).name)
#define PROFILE_CPU_ASSET(asset) ZoneScoped; const StringView __tracy_asset_name((asset)->GetPath()); ZoneName(*__tracy_asset_name, __tracy_asset_name.Length())
#define PROFILE_CPU_ACTOR(actor) ZoneScoped; const StringView __tracy_actor_name((actor)->GetName()); ZoneName(*__tracy_actor_name, __tracy_actor_name.Length())
#else
#define PROFILE_CPU_SRC_LOC(srcLoc) ScopeProfileBlockCPU ProfileBlockCPU((srcLoc).name)
#define PROFILE_CPU_ASSET(asset)
#define PROFILE_CPU_ACTOR(actor)
#endif
#else
@@ -415,5 +417,6 @@ struct TIsPODType<ProfilerCPU::Event>
#define PROFILE_CPU_NAMED(name)
#define PROFILE_CPU_SRC_LOC(srcLoc)
#define PROFILE_CPU_ASSET(asset)
#define PROFILE_CPU_ACTOR(actor)
#endif