Skip to content

Commit

Permalink
Merge pull request #553 from FUSEEProjectTeam/feature/504-fix-rendert…
Browse files Browse the repository at this point in the history
…ests

Feature/504 fix rendertests
  • Loading branch information
RedImp1470 authored Jul 7, 2022
2 parents df7bf7f + 8713e1f commit 15b538c
Show file tree
Hide file tree
Showing 25 changed files with 146 additions and 200 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,13 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Install OpenGL
run: ./ext/install-opengl.ps1
shell: pwsh
- name: Render image compare
run: dotnet run -c Release --project src/Tests/Render/Desktop/Fusee.Tests.Render.Desktop.csproj
- name: Uninstall OpenGL
run: ./ext/install-opengl.ps1 uninstall
shell: pwsh
if: always()
- name: Upload artifact
uses: actions/upload-artifact@v3
if: always()
with:
# Artifact name
name: Rendertests
# Directory containing files to upload
path: |
bin/Release/Tests/Render/Desktop/net6.0/*.png
bin/Release/Tests/Render/Desktop/net6.0/References/*.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 460 core
#version 450 core

//src: https://www.reddit.com/r/Unity3D/comments/7pa6bq/drawing_mandelbrot_fractal_using_gpu_compute/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 460 core
#version 450 core
precision highp float;

in vec2 vUv;
Expand All @@ -8,5 +8,5 @@ uniform sampler2D srcTex;

void main()
{
oColor = texture2D(srcTex, vUv);
oColor = texture(srcTex, vUv);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 460 core
#version 450 core

in vec3 fuVertex;
out vec2 vUv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Fusee.PointCloud.Potree.V2;
using System;
using System.Collections.Generic;
using System.IO;
using static Fusee.Engine.Core.Input;
using static Fusee.Engine.Core.Time;

Expand Down Expand Up @@ -60,6 +61,8 @@ public bool ClosingRequested
private SixDOFDevice _spaceMouse;
private PointCloudComponent _pointCloud;

public string AssetsPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

public override void Init()
{
VSync = false;
Expand Down Expand Up @@ -101,7 +104,7 @@ public override void Init()
};

var potreeReader = new Potree2Reader();
_pointCloud = (PointCloudComponent)potreeReader.GetPointCloudComponent(PtRenderingParams.Instance.PathToOocFile);
_pointCloud = (PointCloudComponent)potreeReader.GetPointCloudComponent(Path.Combine(AssetsPath, PtRenderingParams.Instance.PathToOocFile));
_pointCloud.PointCloudImp.MinProjSizeModifier = PtRenderingParams.Instance.ProjectedSizeModifier;
_pointCloud.PointCloudImp.PointThreshold = PtRenderingParams.Instance.PointThreshold;

Expand Down
Binary file added ext/MesaOpenGL/opengl32.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Engine/Core/RenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ internal void CreateShaderProgram(Effect ef, bool renderForward = true)
if (activeUniforms.Count == 0)
{
var ex = new Exception();
Diagnostics.Error("Error while compiling shader for pass - couldn't get parameters form the gpu!", ex, new string[] { vert, geom, frag }); ;
Diagnostics.Error("Error while compiling shader for pass - couldn't get parameters from the gpu!", ex, new string[] { vert, geom, frag }); ;
throw new Exception("Error while compiling shader for pass.", ex);
}

Expand Down
76 changes: 7 additions & 69 deletions src/Tests/Render/Desktop/Fusee.Tests.Render.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,9 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Common\Fusee.Base.Common.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Core\Fusee.Base.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Imp\Desktop\Fusee.Base.Imp.Desktop.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Common\Fusee.Engine.Common.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Core\Fusee.Engine.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\GUI\Fusee.Engine.Gui.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Imp\Graphics\Desktop\Fusee.Engine.Imp.Graphics.Desktop.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Player\Core\Fusee.Engine.Player.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Jometri\Fusee.Jometri.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Math\Core\Fusee.Math.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Serialization\Fusee.Serialization.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Xene\Fusee.Xene.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Xirkit\Fusee.Xirkit.csproj" />

<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\AdvancedUI\Core\Fusee.Examples.AdvancedUI.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\Camera\Core\Fusee.Examples.Camera.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\ComputeFractal\Core\Fusee.Examples.ComputeFractal.Core.csproj" />
Expand All @@ -28,8 +18,6 @@
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\PointCloudPotree2\Core\Fusee.Examples.PointCloudPotree2.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\RenderContextonly\Core\Fusee.Examples.RenderContextonly.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\RenderLayer\Core\Fusee.Examples.RenderLayer.Core.csproj" />


<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\GeometryEditing\Core\Fusee.Examples.GeometryEditing.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\MeshingAround\Core\Fusee.Examples.MeshingAround.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\Picking\Core\Fusee.Examples.Picking.Core.csproj" />
Expand All @@ -38,72 +26,22 @@
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\ThreeDFont\Core\Fusee.Examples.ThreeDFont.Core.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\Examples\Complete\UI\Core\Fusee.Examples.UI.Core.csproj" />

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit.Console" Version="3.15.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnitLite" Version="3.13.3" />
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />

</ItemGroup>

<ItemGroup>
<None Update="Assets\.emptyFolder">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\AdvancedUI.png">
<None Update="References\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\BoneAnimation.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Camera.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Deferred.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Fractal.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\GeometryEditing.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Labyrinth.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Materials.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\MeshingAround.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\NormalMapping.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Picking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\RenderContextOnly.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\RenderLayer.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\Simple.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\SimpleDeferred.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\ThreeDFont.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="References\UI.png">
</ItemGroup>

<ItemGroup>
<None Include="$(FuseeEngineRoot)\ext\MesaOpenGL\opengl32.dll" Link="opengl32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

5 changes: 4 additions & 1 deletion src/Tests/Render/Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ public static void Init(string arg)

((Engine.Imp.Graphics.Desktop.RenderCanvasImp)app.CanvasImplementor).DoInit();
((Engine.Imp.Graphics.Desktop.RenderCanvasImp)app.CanvasImplementor).DoResize(width, height);
((Engine.Imp.Graphics.Desktop.RenderCanvasImp)app.CanvasImplementor).DoUpdate();

SpinWait.SpinUntil(() => app.IsLoaded);

// skip the first frame, empty, skip the second as deferred needs three, second pass has an empty frame, too
for (var i = 0; i < 3; i++)
for (var i = 0; i < 60; i++)
{
((Engine.Imp.Graphics.Desktop.RenderCanvasImp)app.CanvasImplementor).DoRender();
}

// Render a single frame and save it
using var img = cimp.ShootCurrentFrame(width, height) as Image<Bgra32>;
Expand Down
Binary file modified src/Tests/Render/Desktop/References/AdvancedUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/Camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Tests/Render/Desktop/References/Fractal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/GeometryEditing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/Labyrinth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Tests/Render/Desktop/References/Materials.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/MeshingAround.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Tests/Render/Desktop/References/Picking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/RenderContextOnly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/RenderLayer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Tests/Render/Desktop/References/Simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Tests/Render/Desktop/References/ThreeDFont.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Tests/Render/Desktop/References/UI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 15b538c

Please sign in to comment.