Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
f7510a6
[Games] don't call EndRun if user wants to render with an external ma…
tebjan Dec 20, 2019
6409c5c
[Assets] updated Microsoft.CodeAnalysis.CSharp.Workspaces and Microso…
tebjan Jan 16, 2020
ae9577e
[Assets] updated RoslynPad
tebjan Jan 17, 2020
06cedea
[Build] added XenkoBuildPrerequisitesInstaller parameter for building…
tebjan Jan 22, 2020
d270590
[Build] replaced XenkoSignTool with XenkoSign
tebjan Jan 22, 2020
3e51b45
[Build] added vvvv suffix to nuget special version
tebjan Jan 22, 2020
bb7d0a2
[Build] Cosmetics: tab to spaces
tebjan Jan 22, 2020
8bf031d
[Core] increased version of Microsoft.NETCore.Platforms to 2.2.3
tebjan Jan 24, 2020
7ff8a20
[Games] Disable ThreadThrottler when calling Tick from external appli…
tebjan Jan 30, 2020
22cd03a
[Core] Binary directory can be one level below calling executable. Th…
tebjan Jan 30, 2020
a27d01d
[Games] Added Closing event to GameWindow
tebjan Feb 1, 2020
f4c829f
[Assets] updated RoslyPad and Scripting to use Microsoft.CodeAnalysis…
tebjan Feb 3, 2020
48f2f20
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Feb 7, 2020
0bcd538
[Games] isEndRunRequired logic is closer to original code
tebjan Feb 8, 2020
4fbd484
[Games] Refactored platform specific code to avoid #ifdef in GameBase…
tebjan Feb 9, 2020
49cec35
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Feb 9, 2020
f533ecf
Merge branch 'master' into external-mainloop
tebjan Feb 14, 2020
c1ac37a
Merge branch 'master' into external-mainloop
tebjan Feb 15, 2020
7b8a4dc
Merge branch 'master' into external-mainloop
tebjan Feb 18, 2020
9f87c21
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Mar 7, 2020
b22a2be
[Rendering] Replaced Sin and Cos calls of same angle with sincos()
tebjan Mar 7, 2020
d149c41
[Build] removed "beta02-" suffix from version to prevent long path er…
tebjan Mar 7, 2020
07571c5
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Mar 20, 2020
27abc84
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Mar 22, 2020
80bc65e
Revert "[Rendering] Replaced Sin and Cos calls of same angle with sin…
tebjan Mar 29, 2020
08d13bc
Merge branch 'master' into external-mainloop
tebjan Mar 30, 2020
a70abec
Merge branch 'master' into external-mainloop
tebjan Apr 2, 2020
8af328d
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Apr 9, 2020
c101955
Merge remote-tracking branch 'xenko/master' into external-mainloop
tebjan Apr 16, 2020
37bb804
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 19, 2020
ea595fa
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 22, 2020
795414e
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 22, 2020
f040d9f
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 23, 2020
f121ce3
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 29, 2020
9198a86
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 29, 2020
53196fa
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 30, 2020
5620503
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 30, 2020
75b380c
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Apr 30, 2020
0f678f3
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 3, 2020
9f04f3e
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 3, 2020
fd31285
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 4, 2020
d1df91f
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 5, 2020
11220bb
Merge branch 'master' into external-mainloop-stride
tebjan May 6, 2020
1f3f95d
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 12, 2020
5076d92
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 13, 2020
070a0ab
Merge branch 'add-sdl-user-managing-run' into external-mainloop-strid…
tebjan May 20, 2020
fce9ae1
TEMP: Disabled SpriteStudio in Stride.Core.Assets.CompilerApp since i…
tebjan May 17, 2020
d001cc0
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 21, 2020
d086dbe
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan May 25, 2020
9cc2299
Merge branch 'external-mainloop-stride-sdl' into external-mainloop-st…
tebjan May 25, 2020
3c09e8c
[Games] Fixed SDL window resize initiated by GraphicsDeviceManager af…
tebjan May 25, 2020
aad7f44
Merge branch 'master' into external-mainloop-stride
tebjan Jun 11, 2020
31f1be6
Revert "TEMP: Disabled SpriteStudio in Stride.Core.Assets.CompilerApp…
tebjan Jun 11, 2020
84febb7
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Jul 17, 2020
1d86bde
[Physics] Added setter to use a custom scene system to render the phy…
tebjan Jul 23, 2020
0857125
[Input] Added WindowInputSourceSDL to register the input from additio…
tebjan Jul 26, 2020
d5ea561
[Input] Moved null checks up to input device extensions
tebjan Jul 27, 2020
74dea8b
[Input] SDL input devices generate a unique ID per window
tebjan Jul 27, 2020
aa59d52
[Engine] Removed dependency of camera processor to scene system by re…
azeno Jul 28, 2020
5e6132a
[Engine] Make some APIs public to allow custom drawing of a scene ins…
azeno Jul 28, 2020
2b3af72
[Physics] Remove reference from PhysicsProcessor to SceneSystem to re…
tebjan Jul 29, 2020
25b85cc
[Games] GameProfilingSystem can use a specific presenter to draw the …
tebjan Jul 29, 2020
66b5dca
Merge remote-tracking branch 'vvvv/dev/azeno/use-current-graphics-com…
tebjan Jul 29, 2020
677e0af
Merge remote-tracking branch 'vvvv/dev/azeno/scene-instance-public-dr…
tebjan Jul 29, 2020
787383f
[Games] GameWindowRenderer Present() is called as the last call of th…
tebjan Jul 30, 2020
442e7ec
[Games] GameProfilingSystem can use a custom texture as render target.
tebjan Aug 1, 2020
b56ff52
[Games] GameProfilingSystem exposes ProfilingResults
tebjan Aug 2, 2020
750c76a
[VirtualReality] Updated OpenVR to 1.12.5
tebjan Aug 6, 2020
ae1f69b
[Rendering] Made OutputCount and GetOutput of ImageEffect public
tebjan Aug 8, 2020
1fa9558
Revert "[VirtualReality] Updated OpenVR to 1.12.5"
tebjan Aug 8, 2020
effbfd1
[Rendering] Made InputCount and GetInput of ImageEffect public
tebjan Aug 9, 2020
3631046
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Aug 10, 2020
6d29f59
[Graphics] Added event GraphicsResourceBase.Destroyed which allows cl…
azeno Aug 10, 2020
fa94b83
[Engine] Reevaluate active render stages if the shadow caster propert…
azeno Aug 10, 2020
bf242ab
Merge remote-tracking branch 'vvvv/dev/azeno/resource-destroyed-event…
tebjan Aug 10, 2020
b1a571e
Merge remote-tracking branch 'vvvv/dev/azeno/reeval-shadow-caster' in…
tebjan Aug 10, 2020
269be8e
Merge branch 'master' into external-mainloop-stride
tebjan Aug 13, 2020
0eb5812
The GraphicsPresenter has the ability to fix its BackBuffer Format de…
gregsn Aug 17, 2020
34a9d19
[Stride.Core.Mathematics] Containment method for Vector2 of Rectangle…
tebjan Aug 26, 2020
6a5db9a
[Engine] Making sure the ModelComponent.Update doesn't crash if the s…
tebjan Aug 27, 2020
b52512d
adding Winforms based inputs sources per window
gregsn Aug 27, 2020
400f323
[Engine] Making sure the ModelComponent.Update and RenderProcessor do…
tebjan Aug 27, 2020
a7b52fe
Merge remote-tracking branch 'vvvv/external-mainloop-stride' into ext…
tebjan Aug 27, 2020
90529af
Making sure the ModelComponent.Update and RenderProcessor don't crash…
tebjan Aug 27, 2020
8be79ac
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Sep 8, 2020
2f96f72
[Rendering] Disabled alpha-to-coverage for Blend and Additive transpa…
azeno Sep 9, 2020
20f58e6
Merge branch 'dev/azeno/disable-alpha-to-coverage-for-blend' into ext…
azeno Sep 9, 2020
aa675e6
[Rendering] Check descriptor of material first before looking it up i…
azeno Sep 9, 2020
ffdedc5
Merge branch 'dev/azeno/material-layer-fix' into external-mainloop-st…
azeno Sep 9, 2020
b99fdad
[Stride.Assets.Presentation] Quick fix for build error
tebjan Sep 9, 2020
edff077
Revert "[Stride.Assets.Presentation] Quick fix for build error"
tebjan Sep 10, 2020
ade1e9e
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Sep 10, 2020
c73f161
[Rendering] Fixed null pointer in ImageEffectShader in case no input …
azeno Sep 10, 2020
9bd7094
Merge branch 'dev/azeno/image-effect-shader-null-pointer' into extern…
azeno Sep 10, 2020
6ce481f
Added batch file to compile packages locally for windows platform
azeno Sep 10, 2020
0706439
[Rendering] Pass the graphics device down to the shader generator con…
azeno Sep 11, 2020
7cfcbd8
Merge branch 'dev/azeno/pass-graphics-device' into external-mainloop-…
azeno Sep 11, 2020
0c11451
CameraComponent now can be updated by ignorant third party without an…
gregsn Sep 11, 2020
ea41bfa
Merge branch 'master' into external-mainloop-stride
gregsn Sep 11, 2020
c4dffd8
CameraComponent now can be updated by ignorant third party without an…
gregsn Sep 11, 2020
dd5a84f
Merge remote-tracking branch 'us/master' into external-mainloop-stride
gregsn Sep 11, 2020
f817008
Merge branch 'external-mainloop-stride' of https://github.com/vvvv/st…
tebjan Sep 11, 2020
1570396
[Games] Multi Window: Added GameWindowRendererManager and SDL window …
tebjan Sep 11, 2020
963dbac
Merge branch 'dev/azeno/effect-compiler-explicit-database' into exter…
azeno Sep 14, 2020
1a2b44d
[Graphics] SDL: Don't minimize fullscreen when focus is lost
tebjan Sep 14, 2020
78e74a7
[Rendering] Instancing: Changed Buffer<Matrix> to Buffer, because thi…
tebjan Sep 15, 2020
d442c6a
[Graphics] Added DoNotWait property to SwapChainGraphicsPresenter.Dir…
tebjan Sep 15, 2020
6661a66
[Core] Added GetReferenceCounts to ContentManager
tebjan Sep 17, 2020
075d399
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Sep 17, 2020
4fb2609
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Sep 17, 2020
8578131
[Rendering] Instancing: Skip effect validation if instancing count <=…
tebjan Sep 19, 2020
c91ecf5
Merge branch 'dev/tebjan/instancing-fix-memory-leak' into external-ma…
tebjan Sep 19, 2020
1c132aa
[Engine] Fix Merge conflict
tebjan Sep 19, 2020
6431be8
Merge remote-tracking branch 'upstream/master' into external-mainloop…
azeno Sep 23, 2020
1b7098f
the BackBuffer Format of a GraphicsPresenter gets corrected from an S…
gregsn Sep 23, 2020
aa7a418
Catch type load exceptions when trying to load asset compilers from a…
azeno Sep 26, 2020
562e1dd
[Games] Added SetSize to GameWindow to allow resizing the window by code
tebjan Sep 27, 2020
38f4161
Merge branch 'external-mainloop-stride' of https://github.com/vvvv/st…
tebjan Sep 27, 2020
3aad025
Merge branch 'master' into external-mainloop-stride
tebjan Sep 27, 2020
e1ee5ca
[Games] SDL: Added Alt+Enter (keypad) to fullscreen toggle shortcuts.
tebjan Sep 28, 2020
5a9fca8
[Games] Allow setting the elapsed frame time from external code.
tebjan Oct 22, 2020
a3e9853
[Games] Increased maximumElapsedTime
tebjan Oct 22, 2020
659f6ee
[Graphics] Loading an image as SRgb will now also convert the format …
tebjan Oct 29, 2020
cd983bb
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Oct 29, 2020
c11280b
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Oct 30, 2020
1c0f620
Merge remote-tracking branch 'stride/master' into external-mainloop-s…
tebjan Nov 4, 2020
68271ea
Merge branch 'master' into external-mainloop-stride
tebjan Nov 9, 2020
01c9053
[Engine] Fixes memory leak in forward renderer. The cached depth sten…
azeno Dec 9, 2020
1bfedec
[Rendering] Fixes crash when changing the LightStreak.IsAnamorphic pr…
azeno Dec 10, 2020
e1f43b0
[Rendering] Fixes crash when enabling a color transform during runtime.
azeno Dec 10, 2020
7477736
[Build] Fixes Stride.Assimp.dll not found during package build by ref…
azeno Dec 2, 2020
83c3172
[Graphics] Adds isSRgb parameter to CreateTextureFromNative. Allows t…
tebjan Dec 23, 2020
89d4c6d
[Graphics] Fixed isSRgb parameter for DX12
tebjan Dec 24, 2020
2b38629
[VR] Updates OpenVR to 1.14.15
tebjan Dec 31, 2020
f854ca1
[Graphics] Refines texture initialization from native shader resource…
tebjan Dec 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/compile-windows-runtime.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msbuild Stride.build /t:Package /m /v:m /restore /nr:false /p:StridePlatforms="Windows" /p:StrideGraphicsApiDependentBuildAll=false /p:StrideBuildPrerequisitesInstaller=false /p:StrideSign=false /p:StrideOfficialBuild=false
4 changes: 2 additions & 2 deletions deps/OpenVR/Windows/x64/openvr_api.dll
Git LFS file not shown
4 changes: 2 additions & 2 deletions deps/OpenVR/Windows/x86/openvr_api.dll
Git LFS file not shown
37 changes: 22 additions & 15 deletions sources/assets/Stride.Core.Assets/Compiler/AssetCompilerRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,34 @@ private void RegisterAssembly(Assembly assembly)
private void RegisterCompilersFromAssembly(Assembly assembly)
{
// Process Asset types.
foreach (var type in assembly.GetTypes())
try
{
// Only process Asset types
if (!typeof(IAssetCompiler).IsAssignableFrom(type) || !type.IsClass)
continue;
foreach (var type in assembly.GetTypes())
{
// Only process Asset types
if (!typeof(IAssetCompiler).IsAssignableFrom(type) || !type.IsClass)
continue;

// Asset compiler
var compilerAttribute = type.GetCustomAttribute<AssetCompilerAttribute>();
// Asset compiler
var compilerAttribute = type.GetCustomAttribute<AssetCompilerAttribute>();

if (compilerAttribute == null) // no compiler attribute in this asset
continue;
if (compilerAttribute == null) // no compiler attribute in this asset
continue;

try
{
ProcessAttribute(compilerAttribute, type);
}
catch (Exception ex)
{
log.Error($"Unable to instantiate compiler [{compilerAttribute.TypeName}]", ex);
try
{
ProcessAttribute(compilerAttribute, type);
}
catch (Exception ex)
{
log.Error($"Unable to instantiate compiler [{compilerAttribute.TypeName}]", ex);
}
}
}
catch (Exception e)
{
log.Warning($"Unable to register asset compilers from assembly [{assembly}]", e);
}
}

private void UnregisterAssembly(Assembly assembly)
Expand Down
4 changes: 2 additions & 2 deletions sources/core/Stride.Core.Mathematics/RectangleF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public void Inflate(float horizontalAmount, float verticalAmount)
/// <param name="result">[OutAttribute] true if the specified Point is contained within this rectangle; false otherwise.</param>
public void Contains(ref Vector2 value, out bool result)
{
result = (X <= value.X) && (value.X < Right) && (Y <= value.Y) && (value.Y < Bottom);
result = value.X >= this.X && value.X <= Right && value.Y >= this.Y && value.Y <= Bottom;
}

/// <summary>Determines whether this rectangle entirely contains a specified rectangle.</summary>
Expand All @@ -295,7 +295,7 @@ public void Contains(ref RectangleF value, out bool result)
/// <returns><c>true</c> if point is inside <see cref="RectangleF"/>, otherwise <c>false</c>.</returns>
public bool Contains(float x, float y)
{
return (x >= this.X && x <= Right && y >= this.Y && y <= Bottom);
return x >= this.X && x <= Right && y >= this.Y && y <= Bottom;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,25 @@ public ContentManagerStats GetStats()
return new ContentManagerStats(LoadedAssetUrls.Values);
}

/// <summary>
/// Request the ref counts for a specific asset url.
/// </summary>
public void GetReferenceCounts(string url, out bool exists, out int publicRefCount, out int privateRefCount)
{
if (LoadedAssetUrls.TryGetValue(url, out var reference))
{
exists = true;
publicRefCount = reference.PublicReferenceCount;
privateRefCount = reference.PrivateReferenceCount;
}
else
{
exists = false;
publicRefCount = 0;
privateRefCount = 0;
}
}

private void PrepareSerializerContext(ContentSerializerContext contentSerializerContext, SerializerContext context)
{
context.Set(ContentSerializerContext.ContentSerializerContextProperty, contentSerializerContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\tools\Stride.Assimp\Stride.Assimp.csproj" PrivateAssets="All" />
<ProjectReference Include="..\..\tools\Stride.Assimp.Translation\Stride.Assimp.Translation.vcxproj" PrivateAssets="All" />
<ProjectReference Include="..\..\tools\Stride.Importer.Assimp\Stride.Importer.Assimp.vcxproj" PrivateAssets="All" />
<ProjectReference Include="..\..\tools\Stride.Importer.Common\Stride.Importer.Common.vcxproj" PrivateAssets="All" />
<ProjectReference Include="..\..\tools\Stride.Importer.FBX\Stride.Importer.FBX.vcxproj" PrivateAssets="All" />
Expand Down
11 changes: 6 additions & 5 deletions sources/engine/Stride.Engine.NoAssets.Tests/GameWindowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ public void RenderToWindow(AppContextType contextType)
PerformTest(game =>
{
var context = GameContextFactory.NewGameContext(contextType, isUserManagingRun: true);
var windowRenderer = new GameWindowRenderer(game.Services, context)
{
PreferredBackBufferWidth = 640,
PreferredBackBufferHeight = 480,
};

var windowRenderer = new GameWindowRenderer(game.Services, context);

windowRenderer.WindowManager.PreferredBackBufferWidth = 640;
windowRenderer.WindowManager.PreferredBackBufferHeight = 640;

windowRenderer.Initialize();
((IContentable)windowRenderer).LoadContent();

Expand Down
14 changes: 13 additions & 1 deletion sources/engine/Stride.Engine/Engine/ModelComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,19 @@ internal void Update(TransformComponent transformComponent)
else
{
// If there is a skeleton, use the corresponding node's transform. Otherwise, fall back to the model transform.
var transform = skeleton != null ? skeleton.NodeTransformations[mesh.NodeIndex].WorldMatrix : worldMatrix;
var transform = worldMatrix;
if (skeleton != null && skeleton.NodeTransformations != null)
{
var nodeTransformationsCount = skeleton.NodeTransformations.Length;

if (nodeTransformationsCount > 0)
{
var nodeIndex = mesh.NodeIndex;
if (nodeIndex >= 0 && nodeIndex < nodeTransformationsCount)
transform = skeleton.NodeTransformations[nodeIndex].WorldMatrix;
}
}

BoundingBox.Transform(ref mesh.BoundingBox, ref transform, out meshInfo.BoundingBox);
BoundingSphere.Transform(ref mesh.BoundingSphere, ref transform, out meshInfo.BoundingSphere);
}
Expand Down
52 changes: 42 additions & 10 deletions sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class GameProfilingSystem : GameSystemBase

private Color4 textColor = Color.LightGreen;

private PresentInterval userPresentInterval = PresentInterval.Default;
private Dictionary<GraphicsPresenter, PresentInterval> userPresentInterval = new Dictionary<GraphicsPresenter, PresentInterval>();
private bool userMinimizedState = true;

private int lastFrame = -1;
Expand All @@ -61,7 +61,15 @@ public class GameProfilingSystem : GameSystemBase
private uint trianglesCount;
private uint drawCallsCount;

private struct ProfilingResult : IComparer<ProfilingResult>
/// <summary>
/// Gets or sets the current render target. If null, the <see cref="Game.GraphicsDevice.Presenter.BackBuffer"/> is used.
/// </summary>
/// <value>
/// The render target.
/// </value>
public Texture RenderTarget { get; set; }

public struct ProfilingResult : IComparer<ProfilingResult>
{
public long AccumulatedTime;
public long MinTime;
Expand All @@ -84,6 +92,8 @@ public int Compare(ProfilingResult x, ProfilingResult y)
private readonly List<ProfilingResult> profilingResults = new List<ProfilingResult>();
private readonly Dictionary<ProfilingKey, ProfilingResult> profilingResultsDictionary = new Dictionary<ProfilingKey, ProfilingResult>();

public IReadOnlyList<ProfilingResult> ProfilingResults { get => profilingResults; }

/// <summary>
/// Initializes a new instance of the <see cref="GameProfilingSystem"/> class.
/// </summary>
Expand Down Expand Up @@ -243,7 +253,6 @@ private void UpdateProfilingStrings()
{
AppendEvent(profilingResults[((int)CurrentResultPage - 1) * elementsPerPage + i], elapsedFrames, tickFrequency, containsMarks);
}
profilingResults.Clear();

if (numberOfPages > 1)
profilersStringBuilder.AppendFormat("PAGE {0} OF {1}", CurrentResultPage, numberOfPages);
Expand Down Expand Up @@ -343,6 +352,9 @@ protected override void Destroy()
/// <inheritdoc/>
public override void Draw(GameTime gameTime)
{
// Where to render the result?
var renderTarget = RenderTarget ?? Game.GraphicsDevice.Presenter.BackBuffer;

// copy those values before fast text render not to influence the game stats
drawCallsCount = GraphicsDevice.FrameDrawCalls;
trianglesCount = GraphicsDevice.FrameTriangleCount;
Expand All @@ -351,7 +363,7 @@ public override void Draw(GameTime gameTime)
{
dumpTiming.Restart();

renderTargetSize = new Size2(Game.GraphicsContext.CommandList.RenderTarget.Width, Game.GraphicsContext.CommandList.RenderTarget.Height);
renderTargetSize = new Size2(renderTarget.Width, renderTarget.Height);

if (stringBuilderTask == null || stringBuilderTask.IsCompleted)
{
Expand All @@ -360,7 +372,6 @@ public override void Draw(GameTime gameTime)
}
}

viewportHeight = Game.GraphicsContext.CommandList.Viewport.Height;

if (fastTextRenderer == null)
{
Expand All @@ -372,7 +383,9 @@ public override void Draw(GameTime gameTime)
}

// TODO GRAPHICS REFACTOR where to get command list from?
Game.GraphicsContext.CommandList.SetRenderTargetAndViewport(null, Game.GraphicsDevice.Presenter.BackBuffer);
var commandList = Game.GraphicsContext.CommandList;
commandList.SetRenderTargetAndViewport(null, renderTarget);
viewportHeight = commandList.Viewport.Height;
fastTextRenderer.Begin(Game.GraphicsContext);
lock (stringLock)
{
Expand Down Expand Up @@ -419,11 +432,18 @@ public void EnableProfiling(bool excludeKeys = false, params ProfilingKey[] keys
}

// Backup current PresentInterval state
userPresentInterval = GraphicsDevice.Presenter.PresentInterval;
userPresentInterval[GraphicsDevice.Presenter] = GraphicsDevice.Presenter.PresentInterval;

// Disable VSync (otherwise GPU results might be incorrect)
GraphicsDevice.Presenter.PresentInterval = PresentInterval.Immediate;

foreach (var wp in GraphicsDevice.WindowPresenters)
{
userPresentInterval[wp] = wp.PresentInterval;
wp.PresentInterval = PresentInterval.Immediate;
}


if (keys.Length == 0)
{
Profiler.EnableAll();
Expand Down Expand Up @@ -458,9 +478,21 @@ public void DisableProfiling()
Enabled = false;
Visible = false;

// Restore previous PresentInterval state
GraphicsDevice.Presenter.PresentInterval = userPresentInterval;
userPresentInterval = PresentInterval.Default;
if (userPresentInterval.TryGetValue(GraphicsDevice.Presenter, out var presentInterval))
{
GraphicsDevice.Presenter.PresentInterval = presentInterval;
}

foreach (var wp in GraphicsDevice.WindowPresenters)
{
if (userPresentInterval.TryGetValue(wp, out presentInterval))
{
wp.PresentInterval = presentInterval;
}
}

userPresentInterval.Clear();

if (Game != null)
Game.TreatNotFocusedLikeMinimized = userMinimizedState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,13 @@ private Texture ResolveDepthAsSRV(RenderDrawContext context)

context.CommandList.SetRenderTargets(null, context.CommandList.RenderTargetCount, context.CommandList.RenderTargets);

depthStencilROCached = context.Resolver.GetDepthStencilAsRenderTarget(depthStencil, depthStencilROCached);
var depthStencilROCached = context.Resolver.GetDepthStencilAsRenderTarget(depthStencil, this.depthStencilROCached);
if (depthStencilROCached != this.depthStencilROCached)
{
// Dispose cached view
this.depthStencilROCached?.Dispose();
this.depthStencilROCached = depthStencilROCached;
}
context.CommandList.SetRenderTargets(depthStencilROCached, context.CommandList.RenderTargetCount, context.CommandList.RenderTargets);

return depthStencilSRV;
Expand Down Expand Up @@ -876,6 +882,7 @@ protected virtual void PrepareRenderTargets(RenderDrawContext drawContext, Size2
protected override void Destroy()
{
PostEffects?.Dispose();
depthStencilROCached?.Dispose();
}

[StructLayout(LayoutKind.Sequential)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.

using System;
using System.Collections.Generic;
using Stride.Core;
using Stride.Core.Extensions;
Expand Down Expand Up @@ -108,7 +109,7 @@ private void UpdateRenderModel(ModelComponent modelComponent, RenderModel render
// Copy world matrix
var mesh = renderModel.Model.Meshes[sourceMeshIndex];
var meshInfo = modelComponent.MeshInfos[sourceMeshIndex];
var nodeIndex = mesh.NodeIndex;
var nodeIndex = Math.Min(mesh.NodeIndex, nodeTransformations.Length - 1);
renderMesh.World = nodeTransformations[nodeIndex].WorldMatrix;
renderMesh.IsScalingNegative = nodeTransformations[nodeIndex].IsScalingNegative;
renderMesh.BoundingBox = new BoundingBoxExt(meshInfo.BoundingBox);
Expand Down
31 changes: 26 additions & 5 deletions sources/engine/Stride.Games/GameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ protected GameBase()
DrawTime = new GameTime();
autoTickTimer = new TimerTick();
IsFixedTimeStep = false;
maximumElapsedTime = TimeSpan.FromMilliseconds(500.0);
maximumElapsedTime = TimeSpan.FromMilliseconds(2000.0);
TargetElapsedTime = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / 60); // target elapsed time is by default 60Hz

TargetElapsedTime = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / 60); // target elapsed time is by default 60Hz

TreatNotFocusedLikeMinimized = true;
WindowMinimumUpdateRate = new ThreadThrottler(TimeSpan.FromSeconds(0d));
MinimizedMinimumUpdateRate = new ThreadThrottler(15); // by default 15 updates per second while minimized
Expand Down Expand Up @@ -269,6 +270,17 @@ public bool IsMouseVisible
/// <value>The target elapsed time.</value>
public TimeSpan TargetElapsedTime { get; set; }

/// <summary>
/// Gets or sets the value indicating whether the user provides the elapsed time increment for the time calculation.
/// </summary>
public bool IsUserManagingTime { get; set; }

/// <summary>
/// Gets or sets the elapsed time, for the next tick/update if called from external code. Should be set just before calling the RunCallback.
/// Default is 1/60s, i.e. 60fps
/// </summary>
public TimeSpan ElapsedUserTime { get; set; }

/// <summary>
/// Access to the throttler used to set the minimum time allowed between each updates.
/// </summary>
Expand Down Expand Up @@ -504,10 +516,19 @@ protected virtual void RawTickProducer()
{
try
{
// Update the timer
autoTickTimer.Tick();
TimeSpan elapsedAdjustedTime;

var elapsedAdjustedTime = autoTickTimer.ElapsedTimeWithPause;
if (IsUserManagingTime)
{
// Use user provided time
elapsedAdjustedTime = ElapsedUserTime;
}
else
{
// Update the timer
autoTickTimer.Tick();
elapsedAdjustedTime = autoTickTimer.ElapsedTimeWithPause;
}

if (forceElapsedTimeToZero)
{
Expand Down
Loading