Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions Samples/MacOS/01-ClearScreen/01-ClearScreen.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>

<Compile Include="../../Shared/01-ClearScreen/ClearScreenApp.cs">
<Link>ClearScreenApp.cs</Link>
</Compile>

<Compile Include="../../Shared/MacOSWindow.cs">
<Link>MacOSWindow.cs</Link>
</Compile>

<ProjectReference Include="../../../Src/VulkanCore.csproj">
<Project>{1772437f-982d-4edf-80e8-11b826219041}</Project>
<Name>VulkanCore</Name>
</ProjectReference>

<ProjectReference Include="../../MiniFramework/MiniFramework.csproj">
<Project>{9becf614-4e1a-4053-a7a0-3a7b0bca0cf0}</Project>
<Name>MiniFramework</Name>
</ProjectReference>

<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>4.4.0</Version>
</PackageReference>

<Reference Include="NativeMacOS">
<HintPath>../../Shared/NativeMacOS/NativeMacOS.dll</HintPath>
</Reference>

<None Include="../../Shared/NativeMacOS/libmacwindow.dylib" CopyToOutputDirectory="PreserveNewest"/>

</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions Samples/MacOS/01-ClearScreen/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Reflection;

namespace VulkanCore.Samples.ClearScreen
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
using (var window = new MacOSWindow(
Assembly.GetExecutingAssembly().GetName().Name,
new ClearScreenApp()))
{
window.Initialize();
window.Run();
}
}
}
}
64 changes: 64 additions & 0 deletions Samples/MacOS/02-ColoredTriangle/02-ColoredTriangle.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>

<Compile Include="../../Shared/02-ColoredTriangle/ColoredTriangleApp.cs">
<Link>ColoredTriangleApp.cs</Link>
</Compile>

<None Include="../../Shared/02-ColoredTriangle/Content/CompileShaders.bat">
<Link>../../Content/CompileShaders.bat</Link>
</None>
<None Include="../../Shared/02-ColoredTriangle/Content/Shader.frag">
<Link>../../Content/Shader.frag</Link>
</None>
<None Include="../../Shared/02-ColoredTriangle/Content/Shader.frag.spv">
<Link>../../Content/Shader.frag.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="../../Shared/02-ColoredTriangle/Content/Shader.vert">
<Link>../../Content/Shader.vert</Link>
</None>
<None Include="../../Shared/02-ColoredTriangle/Content/Shader.vert.spv">
<Link>../../Content/Shader.vert.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

<Compile Include="../../Shared/MacOSWindow.cs">
<Link>MacOSWindow.cs</Link>
</Compile>

<ProjectReference Include="../../../Src/VulkanCore.csproj">
<Project>{1772437f-982d-4edf-80e8-11b826219041}</Project>
<Name>VulkanCore</Name>
</ProjectReference>

<ProjectReference Include="../../MiniFramework/MiniFramework.csproj">
<Project>{9becf614-4e1a-4053-a7a0-3a7b0bca0cf0}</Project>
<Name>MiniFramework</Name>
</ProjectReference>

<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>4.4.0</Version>
</PackageReference>

<PackageReference Include="System.Numerics.Vectors">
<Version>4.4.0</Version>
</PackageReference>

<Reference Include="NativeMacOS">
<HintPath>../../Shared/NativeMacOS/NativeMacOS.dll</HintPath>
</Reference>

<None Include="../../Shared/NativeMacOS/libmacwindow.dylib" CopyToOutputDirectory="PreserveNewest"/>

</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions Samples/MacOS/02-ColoredTriangle/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Reflection;

namespace VulkanCore.Samples.ColoredTriangle
{
public class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
using (var window = new MacOSWindow(
Assembly.GetExecutingAssembly().GetName().Name,
new ColoredTriangleApp()))
{
window.Initialize();
window.Run();
}
}
}
}
65 changes: 65 additions & 0 deletions Samples/MacOS/03-TexturedCube/03-TexturedCube.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>

<Compile Include="../../Shared/03-TexturedCube/TexturedCubeApp.cs">
<Link>TexturedCubeApp.cs</Link>
</Compile>

<None Include="../../Shared/03-TexturedCube/Content/Shader.frag">
<Link>../../Content/Shader.frag</Link>
</None>
<None Include="../../Shared/03-TexturedCube/Content/Shader.frag.spv">
<Link>../../Content/Shader.frag.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="../../Shared/03-TexturedCube/Content/Shader.vert">
<Link>../../Content/Shader.vert</Link>
</None>
<None Include="../../Shared/03-TexturedCube/Content/Shader.vert.spv">
<Link>../../Content/Shader.vert.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="../../Shared/03-TexturedCube/Content/IndustryForgedDark512.ktx">
<Link>../../Content/IndustryForgedDark512.ktx</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Compile Include="../../Shared/MacOSWindow.cs">
<Link>MacOSWindow.cs</Link>
</Compile>

<ProjectReference Include="../../../Src/VulkanCore.csproj">
<Project>{1772437f-982d-4edf-80e8-11b826219041}</Project>
<Name>VulkanCore</Name>
</ProjectReference>

<ProjectReference Include="../../MiniFramework/MiniFramework.csproj">
<Project>{9becf614-4e1a-4053-a7a0-3a7b0bca0cf0}</Project>
<Name>MiniFramework</Name>
</ProjectReference>

<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>4.4.0</Version>
</PackageReference>

<PackageReference Include="System.Numerics.Vectors">
<Version>4.4.0</Version>
</PackageReference>

<Reference Include="NativeMacOS">
<HintPath>../../Shared/NativeMacOS/NativeMacOS.dll</HintPath>
</Reference>

<None Include="../../Shared/NativeMacOS/libmacwindow.dylib" CopyToOutputDirectory="PreserveNewest"/>

</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions Samples/MacOS/03-TexturedCube/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Reflection;

namespace VulkanCore.Samples.TexturedCube
{
public class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
using (var window = new MacOSWindow(
Assembly.GetExecutingAssembly().GetName().Name,
new TexturedCubeApp()))
{
window.Initialize();
window.Run();
}
}
}
}
75 changes: 75 additions & 0 deletions Samples/MacOS/04-ComputeParticles/04-ComputeParticles.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>

<Compile Include="../../Shared/04-ComputeParticles/ComputeParticlesApp.cs">
<Link>ComputeParticlesApp.cs</Link>
</Compile>

<None Include="../../Shared/04-ComputeParticles/Content/CompileShaders.bat">
<Link>../../Content/CompileShaders.bat</Link>
</None>
<None Include="../../Shared/04-ComputeParticles/Content/Shader.comp">
<Link>../../Content/Shader.comp</Link>
</None>
<None Include="../../Shared/04-ComputeParticles/Content/shader.comp.spv">
<Link>../../Content/shader.comp.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="../../Shared/04-ComputeParticles/Content/Shader.frag">
<Link>../../Content/Shader.frag</Link>
</None>
<None Include="../../Shared/04-ComputeParticles/Content/shader.frag.spv">
<Link>../../Content/shader.frag.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="../../Shared/04-ComputeParticles/Content/Shader.vert">
<Link>../../Content/Shader.vert</Link>
</None>
<None Include="../../Shared/04-ComputeParticles/Content/shader.vert.spv">
<Link>../../Content/shader.vert.spv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="../../Shared/04-ComputeParticles/Content/ParticleDiffuse.ktx">
<Link>../../Content/ParticleDiffuse.ktx</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Compile Include="../../Shared/MacOSWindow.cs">
<Link>MacOSWindow.cs</Link>
</Compile>

<ProjectReference Include="../../../Src/VulkanCore.csproj">
<Project>{1772437f-982d-4edf-80e8-11b826219041}</Project>
<Name>VulkanCore</Name>
</ProjectReference>

<ProjectReference Include="../../MiniFramework/MiniFramework.csproj">
<Project>{9becf614-4e1a-4053-a7a0-3a7b0bca0cf0}</Project>
<Name>MiniFramework</Name>
</ProjectReference>

<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>4.4.0</Version>
</PackageReference>

<PackageReference Include="System.Numerics.Vectors">
<Version>4.4.0</Version>
</PackageReference>

<Reference Include="NativeMacOS">
<HintPath>../../Shared/NativeMacOS/NativeMacOS.dll</HintPath>
</Reference>

<None Include="../../Shared/NativeMacOS/libmacwindow.dylib" CopyToOutputDirectory="PreserveNewest"/>

</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions Samples/MacOS/04-ComputeParticles/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Reflection;

namespace VulkanCore.Samples.ComputeParticles
{
public class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
using (var window = new MacOSWindow(
Assembly.GetExecutingAssembly().GetName().Name,
new ComputeParticlesApp()))
{
window.Initialize();
window.Run();
}
}
}
}
10 changes: 8 additions & 2 deletions Samples/MiniFramework/VulkanApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace VulkanCore.Samples
{
public enum Platform
{
Android, Win32
Android, Win32, MacOS
}

public interface IVulkanAppHost : IDisposable
Expand Down Expand Up @@ -49,7 +49,8 @@ public void Initialize(IVulkanAppHost host)
{
Host = host;
#if DEBUG
const bool debug = true;
//At the moment molten-vk doesn't support the debug extension
bool debug = host.Platform != Platform.MacOS;
#else
const bool debug = false;
#endif
Expand Down Expand Up @@ -162,6 +163,9 @@ private Instance CreateInstance(bool debug)
case Platform.Win32:
surfaceExtension = Constant.InstanceExtension.KhrWin32Surface;
break;
case Platform.MacOS:
surfaceExtension = Constant.InstanceExtension.MvkMacOSSurface;
break;
default:
throw new NotImplementedException();
}
Expand Down Expand Up @@ -216,6 +220,8 @@ private SurfaceKhr CreateSurface()
return Instance.CreateAndroidSurfaceKhr(new AndroidSurfaceCreateInfoKhr(Host.WindowHandle));
case Platform.Win32:
return Instance.CreateWin32SurfaceKhr(new Win32SurfaceCreateInfoKhr(Host.InstanceHandle, Host.WindowHandle));
case Platform.MacOS:
return Mvk.InstanceExtensions.CreateMacOSSurfaceMvk(Instance, new Mvk.MacOSSurfaceCreateInfoMvk { View = Host.WindowHandle });
default:
throw new NotImplementedException();
}
Expand Down
2 changes: 2 additions & 0 deletions Samples/MiniFramework/VulkanContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ bool GetPresentationSupport(PhysicalDevice physicalDevice, int queueFamilyIndex)
return true;
case Platform.Win32:
return physicalDevice.GetWin32PresentationSupportKhr(queueFamilyIndex);
case Platform.MacOS:
return true;
default:
throw new NotImplementedException();
}
Expand Down
Binary file not shown.
Loading