Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8d846c8
Fixed all compiler errors
RedImp1470 Dec 14, 2021
48b1df3
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Dec 14, 2021
c9df18c
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Dec 14, 2021
40075aa
Temporary solution to bypass missing UniformType.Image2d
RedImp1470 Dec 14, 2021
0f0ed17
Removed try catch from Render()
RedImp1470 Dec 14, 2021
5360d1a
Fixed clear color
RedImp1470 Dec 15, 2021
049f344
SetShaderParam: using Spans where possible
RedImp1470 Dec 15, 2021
90fc069
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Dec 15, 2021
7fde0fc
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Dec 21, 2021
7ff7faf
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Jan 12, 2022
0952cf8
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Jan 21, 2022
ab91d19
Merge remote-tracking branch 'origin/develop' into feature/OpenTk-5.x…
RedImp1470 Jan 28, 2022
21cd4e1
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Feb 4, 2022
0913e24
Merge remote-tracking branch 'origin/develop' into feature/OpenTk-5.x…
RedImp1470 Feb 24, 2022
7924efc
OpenTk version set back to 5.0.0-pre.6
RedImp1470 Feb 25, 2022
93ac20e
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Mar 14, 2022
f1f7db2
Fixed merge errors
RedImp1470 Mar 14, 2022
57f8aca
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Mar 25, 2022
53ba06b
Merge branch 'develop' into feature/OpenTk-5.x-pre
RedImp1470 Mar 31, 2022
4132dea
Merge branch 'develop' into feature/469-OpenTk-5.x
RedImp1470 Apr 12, 2022
6955471
Merge branch 'develop' into feature/469-OpenTk-5.x
RedImp1470 Apr 12, 2022
6401537
Merge branch 'develop' into feature/469-OpenTk-5.x
RedImp1470 May 9, 2022
916637e
Fixed merge errors
RedImp1470 May 9, 2022
886f8ba
Merge remote-tracking branch 'origin/develop' into feature/469-OpenTk…
RedImp1470 May 30, 2022
378214d
OpenTk to v5.0.0-pre.7
RedImp1470 May 30, 2022
afb0db2
Merge branch 'develop' into feature/469-OpenTk-5.x
RedImp1470 Jun 1, 2022
aa32316
Merge branch 'develop' into feature/469-OpenTk-5.x
RedImp1470 Jun 20, 2022
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
2 changes: 1 addition & 1 deletion Examples/Complete/ComputeFractal/Core/ComputeFractal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public override void RenderAFrame()

RWTexture.AsImage = true;
RC.SetEffect(_computeShader);
RC.DispatchCompute(-1, RWTexture.Width / 16, RWTexture.Width / 16, 1);
RC.DispatchCompute(-1, (uint)(RWTexture.Width / 16), (uint)(RWTexture.Width / 16), 1);
RC.MemoryBarrier();
RWTexture.AsImage = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ protected override ITextureHandle RenderAFrame()
{
ReadyToLoadNewFile = true;

return new Engine.Imp.Graphics.Desktop.TextureHandle
{
DepthRenderBufferHandle = -1,
FrameBufferHandle = -1,
TexHandle = -1
};
return new Engine.Imp.Graphics.Desktop.TextureHandle();
}

if (PtRenderingParams.Instance.EdlStrength != 0f)
Expand Down
22 changes: 11 additions & 11 deletions src/Engine/Common/AttributeLocations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,56 @@ public static class AttributeLocations
/// <summary>
/// The vertex attribute location index.
/// </summary>
public static readonly int VertexAttribLocation = 0;
public static readonly uint VertexAttribLocation = 0;

/// <summary>
/// The color attribute location index.
/// </summary>
public static readonly int ColorAttribLocation = 1;
public static readonly uint ColorAttribLocation = 1;

/// <summary>
/// The color attribute location index.
/// </summary>
public static readonly int Color1AttribLocation = 2;
public static readonly uint Color1AttribLocation = 2;

/// <summary>
/// The color attribute location index.
/// </summary>
public static readonly int Color2AttribLocation = 3;
public static readonly uint Color2AttribLocation = 3;

/// <summary>
/// The normal attribute location index.
/// </summary>
public static readonly int NormalAttribLocation = 4;
public static readonly uint NormalAttribLocation = 4;

/// <summary>
/// The uv attribute location index.
/// </summary>
public static readonly int UvAttribLocation = 5;
public static readonly uint UvAttribLocation = 5;

/// <summary>
/// The tangent attribute location index.
/// </summary>
public static readonly int TangentAttribLocation = 6;
public static readonly uint TangentAttribLocation = 6;

/// <summary>
/// The bitangent attribute location index.
/// </summary>
public static readonly int BitangentAttribLocation = 7;
public static readonly uint BitangentAttribLocation = 7;

/// <summary>
/// The bone weight attribute location index.
/// </summary>
public static readonly int BoneWeightAttribLocation = 8;
public static readonly uint BoneWeightAttribLocation = 8;

/// <summary>
/// The bone index attribute location index.
/// </summary>
public static readonly int BoneIndexAttribLocation = 9;
public static readonly uint BoneIndexAttribLocation = 9;

/// <summary>
/// The Fusee platform id attribute location index.
/// </summary>
public static readonly int FuseePlatformIdLocation = 10;
public static readonly uint FuseePlatformIdLocation = 10;
}
}
10 changes: 1 addition & 9 deletions src/Engine/Common/IRenderContextImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,22 +647,14 @@ public interface IRenderContextImp
/// <param name="threadGroupsX">The number of work groups to be launched in the X dimension.</param>
/// <param name="threadGroupsY">The number of work groups to be launched in the Y dimension.</param>
/// <param name="threadGroupsZ">he number of work groups to be launched in the Z dimension.</param>
void DispatchCompute(int kernelIndex, int threadGroupsX, int threadGroupsY, int threadGroupsZ);
void DispatchCompute(int kernelIndex, uint threadGroupsX, uint threadGroupsY, uint threadGroupsZ);

/// <summary>
/// Defines a barrier ordering memory transactions. At the moment it will insert all supported barriers.
/// TODO: Define GLbitfield enum
/// </summary>
void MemoryBarrier();

/// <summary>
/// Draws a Debug Line in 3D Space by using a start and end point (float3).
/// </summary>
/// <param name="start">The start point of the DebugLine.</param>
/// <param name="end">The endpoint of the DebugLine.</param>
/// <param name="color">The color of the DebugLine.</param>
void DebugLine(float3 start, float3 end, float4 color);

/// <summary>
/// Gets the content of the buffer.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Common/IStorageBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public interface IStorageBuffer : IDisposable
/// The binding index point the SSBO will be bound to.
/// Caution: the binding point should not be hard coded in the shader code!
/// </summary>
int BindingIndex { get; set; }
uint BindingIndex { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/Engine/Core/Effects/StorageBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class StorageBuffer<T> : IStorageBuffer where T : struct
/// The binding index point the SSBO will be bound to.
/// Caution: the binding point should not be hard coded in the shader code!
/// </summary>
public int BindingIndex { get; set; }
public uint BindingIndex { get; set; }

/// <summary>
/// Return the number of buffer elements.
Expand Down Expand Up @@ -56,7 +56,7 @@ public IBufferHandle BufferHandle
/// <param name="count">The (fixed) count of buffer elements.</param>
/// <param name="tSize">The size (byte) of one buffer element.</param>
/// <param name="blockBindingIndex">Int that needs to be unique throughout the shader.</param>
public StorageBuffer(RenderCanvas rc, int count, int tSize, int blockBindingIndex)
public StorageBuffer(RenderCanvas rc, int count, int tSize, uint blockBindingIndex)
{
_count = count;
_tSize = tSize;
Expand Down
34 changes: 14 additions & 20 deletions src/Engine/Core/RenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1767,30 +1767,24 @@ public void MemoryBarrier()
/// <param name="threadGroupsX">The number of work groups to be launched in the X dimension.</param>
/// <param name="threadGroupsY">The number of work groups to be launched in the Y dimension.</param>
/// <param name="threadGroupsZ">he number of work groups to be launched in the Z dimension.</param>
public void DispatchCompute(int kernelIndex, int threadGroupsX, int threadGroupsY, int threadGroupsZ)
public void DispatchCompute(int kernelIndex, uint threadGroupsX, uint threadGroupsY, uint threadGroupsZ)
{
if (_currentEffect == null) throw new NullReferenceException("No Compute Shader bound.");
if (_currentEffect.GetType() != typeof(ComputeShader)) throw new NullReferenceException("Bound Effect isn't a Compute Shader.");

try
{
var cFx = GetCompiledFxForRenderMethod(true);
SetCompiledFx(cFx.GpuHandle);
SetRenderStateSet(_currentEffect.RendererStates);
SetGlobalParamsInCurrentFx(cFx);
UpdateAllActiveFxParams(cFx);

_rci.DispatchCompute(kernelIndex, threadGroupsX, threadGroupsY, threadGroupsZ);

// After rendering always cleanup pending meshes, textures and shader effects
_meshManager.Cleanup();
_textureManager.Cleanup();
_effectManager.Cleanup();
}
catch (Exception ex)
{
throw new Exception("Error while rendering pass ", ex);
}

var cFx = GetCompiledFxForRenderMethod(true);
SetCompiledFx(cFx.GpuHandle);
SetRenderStateSet(_currentEffect.RendererStates);
SetGlobalParamsInCurrentFx(cFx);
UpdateAllActiveFxParams(cFx);

_rci.DispatchCompute(kernelIndex, threadGroupsX, threadGroupsY, threadGroupsZ);

// After rendering always cleanup pending meshes, textures and shader effects
_meshManager.Cleanup();
_textureManager.Cleanup();
_effectManager.Cleanup();
}

/// <summary>
Expand Down
28 changes: 28 additions & 0 deletions src/Engine/Imp/Graphics/Android/BufferHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Fusee.Engine.Common;

namespace Fusee.Engine.Imp.Graphics.Android
{
/// <summary>
/// RenderBuffer for OpenGL, an integer value is used as a handle
/// </summary>
internal class RenderBufferHandle : IBufferHandle
{
internal int Handle = -1;
}

/// <summary>
/// FrameBuffer for OpenGL, an integer value is used as a handle
/// </summary>
internal class FrameBufferHandle : IBufferHandle
{
internal int Handle = -1;
}

/// <summary>
/// StorageBuffer for OpenGL, an integer value is used as a handle
/// </summary>
class StorageBufferHandle : IBufferHandle
{
internal int Handle = -1;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
using Fusee.Engine.Common;

#if PLATFORM_DESKTOP

namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID

namespace Fusee.Engine.Imp.Graphics.Android
#endif
{
/// <summary>
/// Contains a handle for any type of attribute buffer stored on GPU memory such as vertices, normals, uvs etc.
/// </summary>
public class AttributeImp : IAttribImp
{
internal int AttributeBufferObject;
}

/// <summary>
/// This is the implementation of the <see cref="IMeshImp" /> interface.
/// It is used to check the status of the informations of a mesh and flush informations if required.
Expand Down
22 changes: 11 additions & 11 deletions src/Engine/Imp/Graphics/Android/RenderContextImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,16 +640,16 @@ public IShaderHandle CreateShaderProgram(string vs, string ps, string gs = null)
GL.AttachShader(program, vertexObject);

// enable GLSL (ES) shaders to use fuVertex, fuColor and fuNormal attributes
GL.BindAttribLocation(program, AttributeLocations.VertexAttribLocation, UniformNameDeclarations.Vertex);
GL.BindAttribLocation(program, AttributeLocations.ColorAttribLocation, UniformNameDeclarations.VertexColor);
GL.BindAttribLocation(program, AttributeLocations.Color1AttribLocation, UniformNameDeclarations.VertexColor1);
GL.BindAttribLocation(program, AttributeLocations.Color2AttribLocation, UniformNameDeclarations.VertexColor2);
GL.BindAttribLocation(program, AttributeLocations.UvAttribLocation, UniformNameDeclarations.TextureCoordinates);
GL.BindAttribLocation(program, AttributeLocations.NormalAttribLocation, UniformNameDeclarations.Normal);
GL.BindAttribLocation(program, AttributeLocations.TangentAttribLocation, UniformNameDeclarations.Tangent);
GL.BindAttribLocation(program, AttributeLocations.BoneIndexAttribLocation, UniformNameDeclarations.BoneIndex);
GL.BindAttribLocation(program, AttributeLocations.BoneWeightAttribLocation, UniformNameDeclarations.BoneWeight);
GL.BindAttribLocation(program, AttributeLocations.BitangentAttribLocation, UniformNameDeclarations.Bitangent);
GL.BindAttribLocation(program, (int)AttributeLocations.VertexAttribLocation, UniformNameDeclarations.Vertex);
GL.BindAttribLocation(program, (int)AttributeLocations.ColorAttribLocation, UniformNameDeclarations.VertexColor);
GL.BindAttribLocation(program, (int)AttributeLocations.Color1AttribLocation, UniformNameDeclarations.VertexColor1);
GL.BindAttribLocation(program, (int)AttributeLocations.Color2AttribLocation, UniformNameDeclarations.VertexColor2);
GL.BindAttribLocation(program, (int)AttributeLocations.UvAttribLocation, UniformNameDeclarations.TextureCoordinates);
GL.BindAttribLocation(program, (int)AttributeLocations.NormalAttribLocation, UniformNameDeclarations.Normal);
GL.BindAttribLocation(program, (int)AttributeLocations.TangentAttribLocation, UniformNameDeclarations.Tangent);
GL.BindAttribLocation(program, (int)AttributeLocations.BoneIndexAttribLocation, UniformNameDeclarations.BoneIndex);
GL.BindAttribLocation(program, (int)AttributeLocations.BoneWeightAttribLocation, UniformNameDeclarations.BoneWeight);
GL.BindAttribLocation(program, (int)AttributeLocations.BitangentAttribLocation, UniformNameDeclarations.Bitangent);

GL.LinkProgram(program);
return new ShaderHandleImp { Handle = program };
Expand Down Expand Up @@ -1688,7 +1688,7 @@ public void MemoryBarrier()
/// <param name="threadGroupsX">The number of work groups to be launched in the X dimension.</param>
/// <param name="threadGroupsY">The number of work groups to be launched in the Y dimension.</param>
/// <param name="threadGroupsZ">he number of work groups to be launched in the Z dimension.</param>
public void DispatchCompute(int kernelIndex, int threadGroupsX, int threadGroupsY, int threadGroupsZ)
public void DispatchCompute(int kernelIndex, uint threadGroupsX, uint threadGroupsY, uint threadGroupsZ)
{
GL.DispatchCompute(threadGroupsX, threadGroupsY, threadGroupsZ);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Fusee.Engine.Common;

#if PLATFORM_DESKTOP
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#endif
{
/// <summary>
/// Implementation of <see cref="IShaderHandle" /> for usage with OpenTK framework.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using Fusee.Engine.Common;

#if PLATFORM_DESKTOP
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#endif
{
/// <summary>
/// Texture Implementation for OpenTK, an integer value is used as a handle
/// Texture Implementation for OpenGL, an integer value is used as a handle
/// </summary>
public class TextureHandle : ITextureHandle
{
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Imp/Graphics/Blazor/RenderContextImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,7 @@ public void ConnectBufferToShaderStorage(IShaderHandle currentProgram, IStorageB
/// <param name="threadGroupsY"></param>
/// <param name="threadGroupsZ"></param>
/// <exception cref="NotImplementedException"></exception>
public void DispatchCompute(int kernelIndex, int threadGroupsX, int threadGroupsY, int threadGroupsZ)
public void DispatchCompute(int kernelIndex, uint threadGroupsX, uint threadGroupsY, uint threadGroupsZ)
{
throw new NotImplementedException();
}
Expand Down
13 changes: 13 additions & 0 deletions src/Engine/Imp/Graphics/Blazor/ShaderHandleImp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Fusee.Engine.Common;

namespace Fusee.Engine.Imp.Graphics.Blazor
{
/// <summary>
/// Implementation of the <see cref="IShaderHandle"/>
/// This object is passed to WebGL and represents a shader program
/// </summary>
public class ShaderHandleImp : IShaderHandle
{
internal WebGLProgram Handle;
}
}
9 changes: 0 additions & 9 deletions src/Engine/Imp/Graphics/Blazor/ShaderParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,4 @@ public class ShaderParam : IShaderParam
{
internal WebGLUniformLocation handle;
}

/// <summary>
/// Implementation of the <see cref="IShaderHandle"/>
/// This object is passed to WebGL and represents a shader program
/// </summary>
public class ShaderHandleImp : IShaderHandle
{
internal WebGLProgram Handle;
}
}
13 changes: 13 additions & 0 deletions src/Engine/Imp/Graphics/Desktop/AttributeImp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Fusee.Engine.Common;
using OpenTK.Graphics;

namespace Fusee.Engine.Imp.Graphics.Desktop
{
/// <summary>
/// Contains a handle for any type of attribute buffer stored on GPU memory such as vertices, normals, uvs etc.
/// </summary>
public class AttributeImp : IAttribImp
{
internal BufferHandle AttributeBufferObject;
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
using Fusee.Engine.Common;
using OpenTK.Graphics;

#if PLATFORM_DESKTOP
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#endif
{
/// <summary>
/// RenderBuffer for OpenTK, an integer value is used as a handle
/// </summary>
public class RenderBufferHandle : IBufferHandle
{
internal int Handle = -1;
internal RenderbufferHandle Handle = new(-1);
}

/// <summary>
/// FrameBuffer for OpenTK, an integer value is used as a handle
/// </summary>
class FrameBufferHandle : IBufferHandle
{
internal int Handle = -1;
internal FramebufferHandle Handle = new(-1);
}

class StorageBufferHandle : IBufferHandle
{
internal int Handle = -1;
internal BufferHandle Handle = new(-1);
}
}
Loading