Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Math functions, automated headless graphics device testing, numerous bug fixes and improvements #77

Merged
merged 63 commits into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
13046f8
Created branch and got list of full MathF functions. Began OpenGL ch…
thargy May 15, 2018
aa7f11f
Merge branch 'master' of https://github.com/mellinoe/ShaderGen into a…
thargy May 16, 2018
1377077
Initial attempt at GLSL implementations for MathF support.
thargy May 16, 2018
ac48fc6
Changed tools to error when called on unavailable and instead moved l…
thargy May 18, 2018
beefe0d
WIP Checking in changes to create new ToolChain system, this massivel…
thargy May 18, 2018
67c8e52
Test project compiles and works. Better encapsulation has made it ea…
thargy May 18, 2018
623712e
Merge branch 'master' of https://github.com/mellinoe/ShaderGen into e…
thargy May 18, 2018
27f4e02
ShaderBuiltins now directly implements Math functions.
thargy May 18, 2018
5f79c5d
Updated known identifiers to use nameof, and added 'E' and 'PI' to Sh…
thargy May 18, 2018
678aee6
Chains to make tool execution more robust.
thargy May 19, 2018
22504a6
Added more robust tool runner.
thargy May 19, 2018
d7713d5
Auto-captures compiled output.
thargy May 19, 2018
2339701
Refactored ShaderGenerator constructor to support specific compute sh…
thargy May 19, 2018
91337af
Fix for #69, ensuring Compute shaders require at least version 320..
thargy May 19, 2018
566a352
Fixes #70, although this version still uses recursion, it calculates …
thargy May 19, 2018
d9ca52d
Fixes #71, ensuring that constructors don't get confused with legitim…
thargy May 19, 2018
5b07502
Begins support for #72 by allowing constructor bodies to be supplied.…
thargy May 19, 2018
124c692
WIP #65, creating test compute shaders.
thargy May 19, 2018
6e709c2
Updated fix for #70, as boolean is not a blittable type we should pro…
thargy May 20, 2018
b1b169d
Almost working end to end test of compute shader!
thargy May 20, 2018
2035cd3
Added compute tests for each backend.
thargy May 20, 2018
f283e43
Added comparison code to compare CPU & GPU output and compute shader …
thargy May 20, 2018
b032cf0
Added information to indicate which method failed in the compute shader.
thargy May 20, 2018
8c1e7e6
Fixes issues reported in mellinoe/veldrid#80. All tests now passing …
thargy May 21, 2018
9f0e394
Added headless creation support to ToolChain as suggested in mellinoe…
thargy May 21, 2018
ef8083a
Changed test to use headless graphics device code from ToolChain.
thargy May 22, 2018
58aad9b
Merge branch 'master' into enhanced_backend
thargy May 22, 2018
c81c164
Shader test now has tests for all maths functions and runs tests mult…
thargy May 22, 2018
7a75a53
Completed implementation in HLSL, which now fully compiles.
thargy May 22, 2018
889d3f6
Added GlslEs300 support for new maths functions, fully compiles.
thargy May 22, 2018
cb639b4
Full implemented Glsl450 (Vulkan) and shader now compiles.
thargy May 22, 2018
8241f84
All builtins now supported on all backends (though can't test Metal).
thargy May 22, 2018
f7a6a59
Fixed Lerp and SmoothStep CPU implementations. Added more tolerance …
thargy May 22, 2018
76e7613
Implemented Mul. Clamp now returns NaN for invalid min/max. Fixed F…
thargy May 22, 2018
ceda141
Added Mellinoe myget to Nuget.Config to allow CI server to get latest…
thargy May 22, 2018
fca7a27
Increased default ToolChain timeout (and added constant). Start time…
thargy May 22, 2018
65afde5
Added more robust checking to see if a headless device is available. …
thargy May 22, 2018
2e5b4df
Auto-detecting headless seems to fail on AppVeyor, changed to only at…
thargy May 22, 2018
01d5548
Changed Headless detection to lazy initialisation, to see if it can r…
thargy May 22, 2018
28a76db
Final attempt at preventing XUnit failure on CI server.
thargy May 22, 2018
de2b16a
Added last ditch check to prevent test failures onf CI when headless …
thargy May 22, 2018
d1b37a3
More minor changes to improve CI build?
thargy May 22, 2018
7f23853
Removed headless checks in Fact attributes as it crashes CI server wi…
thargy May 22, 2018
5303ce3
Major refactor to tool chain to support more extensibility and a new …
thargy May 26, 2018
5c71031
WIP To support auto-generation of test cases. split ShaderBuiltins in…
thargy May 26, 2018
c822de9
Rolled out split of ShaderBuiltins and Builtins. Kept changes to Too…
thargy May 26, 2018
e7d1fa3
Fix issue when using fully qualified name for structured buffer and r…
thargy May 26, 2018
1493a1d
Fixed bug with create headless and create windowed (for future expans…
thargy May 26, 2018
69a9808
Added lazy initialisation into test utils to improve test performance.
thargy May 26, 2018
bb1ed9c
Added Skip message for ShaderBuiltinsTest to prevent CI server issues…
thargy May 26, 2018
3324131
Added code to disable graphics device creation on CI servers as it se…
thargy May 26, 2018
3a3fac2
Addresses simple changes for GH-77
thargy May 27, 2018
cf514ba
Removed skip on ShaderBuiltinsTests.
thargy May 27, 2018
3adf95a
Added R# settings to enforce brace style, and ran across solution to …
thargy May 27, 2018
14fc8f7
Replaces random structure creation logic as per GH-77.
thargy May 27, 2018
339ae96
Changed all Tuples to Value Tuples with proper names as per GH-77.
thargy May 27, 2018
de3c487
Added logic to prevent failures in reading the tool output from maski…
thargy May 28, 2018
0c07d06
Fixed naming of dfdx and dfdy as per GH-77.
thargy May 29, 2018
6be9b0e
Fixed ambiguous atan/pow function output when the second parameter re…
thargy May 29, 2018
a930183
Check for compute shader support as per GH-77.
thargy May 30, 2018
5dbf405
Use two-stage compilation in the Metal toolchain.
mellinoe May 30, 2018
7a1c67c
Ensure code is propogated to CompileResult in MetalCompile when passi…
thargy May 30, 2018
7eee0d7
Force float-type parameters in appopriate pow/atan overloads.
mellinoe May 30, 2018
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 NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<packageSources>
<add key="dotnet-myget dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="dotnet-myget dotnet-corefxlab" value="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json" />
<add key="myget mellinoe" value="https://www.myget.org/F/mellinoe/api/v3/index.json" />
</packageSources>
</configuration>
59 changes: 54 additions & 5 deletions src/ShaderGen.Primitives/RWStructuredBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,64 @@
namespace ShaderGen
using System;
using System.Collections.Generic;
using System.Linq;

namespace ShaderGen
{
/// <summary>
/// A writable structured buffer.
/// </summary>
/// <typeparam name="T"></typeparam>
public class RWStructuredBuffer<T> where T : struct
{
public ref T this[int index]
/// <summary>
/// The data.
/// </summary>
private readonly T[] _data;

/// <summary>
/// Initializes a new instance of the <see cref="RWStructuredBuffer{T}" /> class.
/// </summary>
/// <param name="data">The data.</param>
/// <remarks>
/// Note, use with caution as this sets the underlying data to the passed in array.
/// TODO Implement shader code to mimic behaviour of calling constructor.
/// </remarks>
public RWStructuredBuffer(ref T[] data)
{
get => throw new ShaderBuiltinException();
_data = data;
}

public ref T this[uint index]
/// <summary>
/// Initializes a new instance of the <see cref="RWStructuredBuffer{T}" /> class.
/// </summary>
/// <param name="capacity">The capacity.</param>
/// <remarks>
/// TODO Implement shader code to mimic behaviour of calling constructor.
/// </remarks>
public RWStructuredBuffer(int capacity) : this((uint)capacity) { }
public RWStructuredBuffer(uint capacity)
{
get => throw new ShaderBuiltinException();
_data = new T[capacity];
}

/// <summary>
/// Gets the <see cref="T" /> with the specified index.
/// </summary>
/// <value>
/// The <see cref="T" />.
/// </value>
/// <param name="index">The index.</param>
/// <returns></returns>
public ref T this[int index] => ref _data[index];

/// <summary>
/// Gets the <see cref="T" /> with the specified index.
/// </summary>
/// <value>
/// The <see cref="T" />.
/// </value>
/// <param name="index">The index.</param>
/// <returns></returns>
public ref T this[uint index] => ref _data[index];
}
}
13 changes: 13 additions & 0 deletions src/ShaderGen.Primitives/ShaderBuiltinException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Runtime.CompilerServices;

namespace ShaderGen
{
public class ShaderBuiltinException : Exception
{
internal ShaderBuiltinException([CallerMemberName] string memberName = null)
: base($"{nameof(ShaderBuiltins)}.{memberName} can only be executed on the GPU.")
{
}
}
}
335 changes: 258 additions & 77 deletions src/ShaderGen.Primitives/ShaderBuiltins.cs

Large diffs are not rendered by default.

99 changes: 0 additions & 99 deletions src/ShaderGen.Tests/FxcTool.cs

This file was deleted.

107 changes: 0 additions & 107 deletions src/ShaderGen.Tests/GlslangValidatorTool.cs

This file was deleted.

8 changes: 3 additions & 5 deletions src/ShaderGen.Tests/IShaderSetProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ public class IShaderSetProcessorTests
[Fact]
private void TestProcessor_UsersArgs()
{
Compilation compilation = TestUtil.GetTestProjectCompilation();
Compilation compilation = TestUtil.GetCompilation();
HlslBackend backend = new HlslBackend(compilation);
TestProcessor processor = new TestProcessor();
ShaderGenerator sg = new ShaderGenerator(
compilation,
"TestShaders.ProcessorTestShaders.VS",
"TestShaders.ProcessorTestShaders.FS",
new[] { backend },
new[] { processor });
backend,
"TestShaders.ProcessorTestShaders.VS", "TestShaders.ProcessorTestShaders.FS", null, processor);
sg.GenerateShaders();
Assert.Equal("This Sentence Should Be Printed By_Enumerating All Resources In Order", processor.Result);
}
Expand Down
Loading