- wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
- sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-bionic.list https://packages.lunarg.com/vulkan/lunarg-vulkan-bionic.list
- sudo apt -qq update
- - sudo apt install vulkan-sdk
+ - sudo apt -y install vulkan-sdk
script:
- dotnet build /p:Configuration=ReleaseSpirVTasks
<RestoreAdditionalProjectSources Condition="Exists('$(SolutionDir)build\$(Configuration)\')">$(SolutionDir)build\$(Configuration)\</RestoreAdditionalProjectSources>
<SpirVTasksReleaseVersion>0.1.44</SpirVTasksReleaseVersion>
<SpirVTasksPackageVersion>$(SpirVTasksReleaseVersion)</SpirVTasksPackageVersion>
- <VkeReleaseVersion>0.1.21</VkeReleaseVersion>
- <VkePackageVersion>$(VkeReleaseVersion)</VkePackageVersion>
+ <VkeReleaseVersion>0.2.0</VkeReleaseVersion>
+ <VkePackageVersion>$(VkeReleaseVersion)-beta</VkePackageVersion>
<UseStbSharp>true</UseStbSharp>
<UseMemoryPools>false</UseMemoryPools>
<LangVersion>7.2</LangVersion>
<RestoreAdditionalProjectSources Condition="Exists('$(SolutionDir)build\$(Configuration)\')">$(SolutionDir)build\$(Configuration)\</RestoreAdditionalProjectSources>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;_WITH_SHADOWS;WITH_VKVG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DefineConstants>NETSTANDARD;NETSTANDARD2_0;WITH_SHADOWS;_WITH_VKVG</DefineConstants>
- </PropertyGroup>
-
<ItemGroup Condition=" '$(Configuration)|$(Platform)' != 'BuildPackages|AnyCPU' ">
<ProjectReference Include="..\..\vke\vke.csproj" />
</ItemGroup>
```xml
<Project Sdk="Microsoft.NET.Sdk">
- <TargetFrameworks>net472</TargetFrameworks>
- <OutputType>Exe</OutputType>
+ <PropertyGroup>
+ <TargetFrameworks>net472</TargetFrameworks>
+ <OutputType>Exe</OutputType>
+ </PropertyGroup>
<ItemGroup>
<GLSLShader Include="shaders\*.*" />
</ItemGroup>
### Vulkan Initialization
-`initVulkan` is the first method called by the 'Run' method. Default initialization will provide a vulkan window, a default swap chain bound to it, and a draw and present semaphore to sync the rendering.
+**`initVulkan`** is the first method called by the **'Run'** method. Default initialization will provide a vulkan window, a default swap chain bound to it, and a draw and present semaphore to sync the rendering.
```csharp
protected override void initVulkan () {
base.initVulkan ();
### Frame buffer creation
-The resize method is called at least once before any rendering, so it's a safe place to initialize output size related vulkan objects like the frame buffers. vke provide a FrameBuffer collection object to ease handling of multiple related buffers like those used for a swap chain for example..
+The **`OnResize`** method is called at least once before any rendering, so it's a safe place to initialize output size related vulkan objects like the frame buffers. vke provide a FrameBuffer collection object to ease handling of multiple related buffers like those used for a swap chain for example..
```csharp
FrameBuffers frameBuffers;
}
}
- //frame buffer collection to handle on fb per swapchain image.
+ //frame buffer collection to handle one frame buffer per swapchain image.
FrameBuffers frameBuffers;
RenderPass renderPass;
protected override void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
rotY -= rotSpeed * (float)diffX;
rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
+ updateViewRequested = true;
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
zoom += zoomSpeed * (float)diffY;
+ updateViewRequested = true;
}
-
- updateViewRequested = true;
}
protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
### Enabling extensions
-The `VkWindow` class provides two properties that you may override to enable additional extensions.
+The **`VkWindow`** class provides two properties that you may override to enable additional extensions.
+```csharp
+public override string[] EnabledInstanceExtensions => new string[] {
+ Ext.I.VK_EXT_debug_utils
+};
+public override string[] EnabledDeviceExtensions => new string[] {
+ Ext.D.VK_KHR_swapchain,
+};
+```
+Extension's names are organized in two subclasses of the `Ext` static class, one for the instance extensions (**`Ext.I`**) and one for the device ones (**`Ext.D`**).
### Enabling features
-Override the `configureEnabledFeatures` method of `VkWindow` to enable features.
+Override the **`configureEnabledFeatures`** method of **`VkWindow`** to enable features. This method is called just after
+the physical device selection, available features list is automatically queried from it and provided as the first argument.
```csharp
protected override void configureEnabledFeatures (
- VkPhysicalDeviceFeatures available_features,
- ref VkPhysicalDeviceFeatures enabled_features)
-{
- enabled_features.samplerAnisotropy = available_features.samplerAnisotropy;
+ VkPhysicalDeviceFeatures available_features,
+ ref VkPhysicalDeviceFeatures enabled_features) {
+
+ enabled_features.samplerAnisotropy = available_features.samplerAnisotropy;
}
```
### Creating queues
-To create queues, override the `createQueues` method of `VkWindow`. This function is called before the logical device creation and will take care of physically available queues, creating duplicates if count exceed availability. The `base` method will create a default presentable queue.
+To create queues, override the **`createQueues`** method of **`VkWindow`**. This function is called before the logical device creation and will take care of physically available queues, creating duplicates if count exceed availability. The `base` method will create a default presentable queue.
```csharp
protected override void createQueues () {
base.createQueues ();
transferQ = new Queue (dev, VkQueueFlags.Transfer);
-}
-```
\ No newline at end of file
+}
\ No newline at end of file
vke.Run ();
}
}
- protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures features) {
- base.configureEnabledFeatures (available_features, ref features);
- features.textureCompressionBC = available_features.textureCompressionBC;
- features.textureCompressionASTC_LDR = available_features.textureCompressionASTC_LDR;
+ protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features) {
+ base.configureEnabledFeatures (available_features, ref enabled_features);
+ enabled_features.textureCompressionBC = available_features.textureCompressionBC;
+ enabled_features.textureCompressionASTC_LDR = available_features.textureCompressionASTC_LDR;
}
float rotSpeed = 0.01f, zoomSpeed = 0.01f;
protected override void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
rotY -= rotSpeed * (float)diffX;
rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
zoom += zoomSpeed * (float)diffY;
}
protected override void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
rotY -= rotSpeed * (float)diffX;
rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
+ updateViewRequested = true;
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
zoom += zoomSpeed * (float)diffY;
+ updateViewRequested = true;
}
-
- updateViewRequested = true;
}
protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
### Creating buffers
-Vke has two classes to handle buffers. Mappable [`HostBuffer`](../../wiki/api/HostBuffer) and device only [`GPUBuffer`](../../wiki/api/GPUBuffer).
+Vke has two classes to handle buffers. Mappable [`HostBuffer`](../../../../wiki/vke.HostBuffer) and device only [`GPUBuffer`](../../../../wiki/vke.GPUBuffer).
For this first simple example, we will only use host mappable buffers. Those classes can handle a Generic argument of a blittable type to handle arrays. Resources like buffers or images are activated in constructor, and they need to be explicitly disposed on cleanup. Create them in the `initVulkan` override.
```csharp
```csharp
descriptorPool = new DescriptorPool (dev, 1, new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer));
```
-Graphic pipeline configuration are predefined by the [`GraphicPipelineConfig`](../../wiki/api/GraphicPipelineConfig) class, which ease sharing configs for several pipelines having lots in common. The pipeline layout will be automatically activated on pipeline creation, so that sharing layout among different pipelines will benefit from the reference counting to automatically dispose unused layout on pipeline clean up. It's the same for [`DescriptorSetLayout`](../../wiki/api/DescriptorSetLayout).
+Graphic pipeline configuration are predefined by the [`GraphicPipelineConfig`](../../../../wiki/vke.GraphicPipelineConfig) class, which ease sharing configs for several pipelines having lots in common. The pipeline layout will be automatically activated on pipeline creation, so that sharing layout among different pipelines will benefit from the reference counting to automatically dispose unused layout on pipeline clean up. It's the same for [`DescriptorSetLayout`](../../wiki/api/DescriptorSetLayout).
```csharp
GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (
VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
new VkDescriptorSetLayoutBinding (
0, VkShaderStageFlags.Vertex, VkDescriptorType.UniformBuffer)));
```
-Next we configure a default [`RenderPass`](../../wiki/api/RenderPass) with just a color attachment for the swap chain image, a default sub-pass is automatically created and the render pass activation will follow the pipeline life cycle and will be automatically disposed when no longer in use.
+Next we configure a default [`RenderPass`](../../../../wiki/vke.RenderPass) with just a color attachment for the swap chain image, a default sub-pass is automatically created and the render pass activation will follow the pipeline life cycle and will be automatically disposed when no longer in use.
```csharp
cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, cfg.Samples);
```
cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, //position
VkFormat.R32g32b32Sfloat);//color
```
-shader are automatically compiled by [`SpirVTacks`](../../SpirVTasks/README.md) if added to the project. The resulting shaders are automatically embedded in the assembly. To specifiy that the shader path is a resource name, put the **'#'** prefix. Else the path will be search on disk.
+shader are automatically compiled by [`SpirVTasks`](../../SpirVTasks/README.md) if added to the project. The resulting shaders are automatically embedded in the assembly. To specifiy that the shader path is a resource name, put the **'#'** prefix. Else the path will be search on disk.
```csharp
cfg.AddShader (VkShaderStageFlags.Vertex, "#shaders.main.vert.spv");
cfg.AddShader (VkShaderStageFlags.Fragment, "#shaders.main.frag.spv");
```csharp
descriptorSet = descriptorPool.Allocate (pipeline.Layout.DescriptorSetLayouts[0]);
```
-The descriptor update is a two step operation. First we create a [`DescriptorSetWrites`](../../wiki/api/DescriptorSetWrites) object defining the layout(s), than we write the descriptor(s).
+The descriptor update is a two step operation. First we create a [`DescriptorSetWrites`](../../../../wiki/vke.DescriptorSetWrites) object defining the layout(s), than we write the descriptor(s).
The `Descriptor` property of the mvp HostBuffer will return a default descriptor with no offset of the full size of the buffer.
```csharp
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-//using System.Text;
using vke;
using Vulkan;
+using Glfw;
//the traditional triangle sample
namespace Triangle {
protected override void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton [0]) {
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
rotY -= rotSpeed * (float)diffX;
rotX += rotSpeed * (float)diffY;
- } else if (MouseButton [1]) {
+ updateViewRequested = true;
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
zoom += zoomSpeed * (float)diffY;
- } else
- return;
- //VkWindow has a boolean for requesting a call to 'UpdateView', it will be
- //reset by the 'UpdateView' base method or the custom override.
- updateViewRequested = true;
+ updateViewRequested = true;
+ }
}
void buildCommandBuffers() {
#endif
SwapChain.PREFERED_FORMAT = VkFormat.B8g8r8a8Srgb;
DeferredPbrRenderer.TEXTURE_ARRAY = true;
- DeferredPbrRenderer.NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
+ DeferredPbrRenderer.NUM_SAMPLES = VkSampleCountFlags.SampleCount4;
DeferredPbrRenderer.HDR_FORMAT = VkFormat.R32g32b32a32Sfloat;
DeferredPbrRenderer.MRT_FORMAT = VkFormat.R32g32b32a32Sfloat;
protected override void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- camera.Rotate ((float)-diffY, (float)-diffX, 0);
- } else if (MouseButton[1]) {
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
+ camera.Rotate ((float)-diffY, (float)-diffX);
+ updateViewRequested = true;
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
camera.SetZoom ((float)diffY);
- } else
- return;
-
- updateViewRequested = true;
+ updateViewRequested = true;
+ }
}
protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
switch (key) {
+++ /dev/null
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Numerics;
-using System.Runtime.InteropServices;
-
-using Vulkan;
-
-namespace vke {
- using vke.glTF;
-
-
- //TODO:stride in buffer views?
- public class PbrModel2 : PbrModelSeparatedTextures {
- public PbrModel2 (Queue transferQ, string path, DescriptorSetLayout layout, params AttachmentType[] attachments)
- : base (transferQ, path, layout, attachments) {}
-
- //TODO:destset for binding must be variable
- //TODO: ADD REFAULT MAT IF NO MAT DEFINED
- public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
- Matrix4x4 localMat = node.localMatrix * currentTransform;
-
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Vertex, localMat);
-
- if (node.Mesh != null) {
- foreach (Primitive p in node.Mesh.Primitives) {
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4> ());
- if (descriptorSets[p.material] != null)
- cmd.BindDescriptorSet (pipelineLayout, descriptorSets[p.material], 1);
- cmd.DrawIndexed (p.indexCount, 1, p.indexBase, p.vertexBase, 0);
- }
- }
- if (node.Children == null)
- return;
- foreach (Node child in node.Children)
- RenderNode (cmd, pipelineLayout, child, localMat);
- }
- }
-}
using System;
using System.Numerics;
using System.Runtime.InteropServices;
+using vke;
+using vke.glTF;
+using vke.Environment;
using Vulkan;
-namespace vke {
+namespace pbrSample
+{
class PBRPipeline : GraphicPipeline {
-
+ public class PbrModel : PbrModelSeparatedTextures
+ {
+ public PbrModel (Queue transferQ, string path, DescriptorSetLayout layout, params AttachmentType[] attachments)
+ : base (transferQ, path, layout, attachments) { }
+
+ //TODO:destset for binding must be variable
+ //TODO: ADD REFAULT MAT IF NO MAT DEFINED
+ public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
+ Matrix4x4 localMat = node.localMatrix * currentTransform;
+
+ cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Vertex, localMat);
+
+ if (node.Mesh != null) {
+ foreach (Primitive p in node.Mesh.Primitives) {
+ cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4> ());
+ if (descriptorSets[p.material] != null)
+ cmd.BindDescriptorSet (pipelineLayout, descriptorSets[p.material], 1);
+ cmd.DrawIndexed (p.indexCount, 1, p.indexBase, p.vertexBase, 0);
+ }
+ }
+ if (node.Children == null)
+ return;
+ foreach (Node child in node.Children)
+ RenderNode (cmd, pipelineLayout, child, localMat);
+ }
+ }
public struct Matrices {
public Matrix4x4 projection;
public Matrix4x4 model;
DescriptorSetLayout descLayoutTextures;
public DescriptorSet dsMain;
- public PbrModel2 model;
- public vke.Environment.EnvironmentCube envCube;
- string[] cubemapPathes = {
- Utils.DataDirectory + "textures/papermill.ktx",
- Utils.DataDirectory + "textures/cubemap_yokohama_bc3_unorm.ktx",
- Utils.DataDirectory + "textures/gcanyon_cube.ktx",
- Utils.DataDirectory + "textures/pisa_cube.ktx",
- Utils.DataDirectory + "textures/uffizi_cube.ktx",
- };
- public PBRPipeline (Queue staggingQ, RenderPass renderPass, PipelineCache pipelineCache = null) :
+ public PbrModel model;
+ public EnvironmentCube envCube;
+ public PBRPipeline (Queue staggingQ, RenderPass renderPass, string cubeMapPath, PipelineCache pipelineCache = null) :
base (renderPass, pipelineCache, "pbr pipeline") {
descriptorPool = new DescriptorPool (Dev, 2,
new VkPushConstantRange (VkShaderStageFlags.Fragment, sizeof(int), 64)
);
cfg.RenderPass = renderPass;
- cfg.AddVertexBinding<PbrModel2.Vertex> (0);
+ cfg.AddVertexBinding<PbrModel.Vertex> (0);
cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat, VkFormat.R32g32Sfloat);
cfg.AddShader (Dev, VkShaderStageFlags.Vertex, "#shaders.pbr.vert.spv");
dsMain = descriptorPool.Allocate (descLayoutMain);
- envCube = new Environment.EnvironmentCube (cubemapPathes[0], layout, staggingQ, RenderPass);
+ envCube = new EnvironmentCube (cubeMapPath, layout, staggingQ, RenderPass);
matrices.prefilteredCubeMipLevels = envCube.prefilterCube.CreateInfo.mipLevels;
uboMats = new HostBuffer (Dev, VkBufferUsageFlags.UniformBuffer, matrices, true);
public void LoadModel (Queue staggingQ, string path) {
model?.Dispose ();
- model = new PbrModel2 (staggingQ, path, descLayoutTextures,
+ model = new PbrModel (staggingQ, path, descLayoutTextures,
AttachmentType.Color,
AttachmentType.PhysicalProps,
AttachmentType.Normal,
vke.Run ();
}
}
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1;
+ VkSampleCountFlags samples = VkSampleCountFlags.SampleCount4;
FrameBuffers frameBuffers;
PBRPipeline pbrPipeline;
Utils.DataDirectory + "models/MER_static.glb",
Utils.DataDirectory + "models/Box.gltf",
};
+ string[] cubemapPathes = {
+ Utils.DataDirectory + "textures/papermill.ktx",
+ Utils.DataDirectory + "textures/cubemap_yokohama_bc3_unorm.ktx",
+ Utils.DataDirectory + "textures/gcanyon_cube.ktx",
+ Utils.DataDirectory + "textures/pisa_cube.ktx",
+ Utils.DataDirectory + "textures/uffizi_cube.ktx",
+ };
+
DebugView currentDebugView = DebugView.none;
camera.SetPosition (0, 0, -2);
pbrPipeline = new PBRPipeline (presentQueue,
- new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), samples));
+ new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), samples), cubemapPathes[0]);
loadCurrentModel ();
}
protected override void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- camera.Rotate ((float)-diffY, (float)-diffX,0);
- } else if (MouseButton[1]) {
+ if (GetButton (MouseButton.Left) == InputAction.Press) {
+ camera.Rotate ((float)-diffY, (float)-diffX);
+ updateViewRequested = true;
+ } else if (GetButton (MouseButton.Right) == InputAction.Press) {
camera.SetZoom ((float)diffY);
- } else
- return;
-
- updateViewRequested = true;
+ updateViewRequested = true;
+ }
}
protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
namespace vke
{
+ /// <summary>
+ /// Collection of FrameBuffers, useful to handle multiple framebuffers for a swapchain.
+ /// </summary>
public class FrameBuffers : Collection<FrameBuffer>, IDisposable
{
//public Framebuffer this[int index] => Items[index];
protected bool updateViewRequested = true;
protected double lastMouseX { get; private set; }
protected double lastMouseY { get; private set; }
- protected bool[] MouseButton => buttons;
/// <summary>readonly GLFW window handle</summary>
public IntPtr WindowHandle => hWin;
/**Default camera initialized with a Field of view of 40° and and aspect ratio of 1. */
protected Camera camera = new Camera (Utils.DegreesToRadians (45f), 1f);
-
- bool[] buttons = new bool[10];
+
public Modifier KeyModifiers = 0;
IntPtr currentCursor;
uint frameCount;
protected virtual void onMouseMove (double xPos, double yPos) {
double diffX = lastMouseX - xPos;
double diffY = lastMouseY - yPos;
- if (MouseButton[(int)Glfw.MouseButton.Left]) {
+ if (GetButton(MouseButton.Left) == InputAction.Press) {
camera.Rotate ((float)-diffX, (float)-diffY);
updateViewRequested = true;
- } else if (MouseButton[(int)Glfw.MouseButton.Right]) {
+ } else if (GetButton(MouseButton.Right) == InputAction.Press) {
camera.Move ((float)diffX,0,0);
camera.Move (0, 0, (float)-diffY);
updateViewRequested = true;
protected virtual void onKeyUp (Key key, int scanCode, Modifier modifiers) { }
protected virtual void onChar (CodePoint cp) { }
+ protected InputAction GetButton (MouseButton button) =>
+ Glfw3.GetMouseButton (hWin, button);
+
#region events delegates
static CursorPosDelegate HandleCursorPosDelegate = (window, xPosition, yPosition) => {
windows[window].lastMouseY = yPosition;
};
static MouseButtonDelegate HandleMouseButtonDelegate = (IntPtr window, Glfw.MouseButton button, InputAction action, Modifier mods) => {
- if (action == InputAction.Press) {
- windows[window].buttons[(int)button] = true;
+ if (action == InputAction.Press)
windows[window].onMouseButtonDown (button);
- } else {
- windows[window].buttons[(int)button] = false;
+ else
windows[window].onMouseButtonUp (button);
- }
};
static ScrollDelegate HandleScrollDelegate = (IntPtr window, double xOffset, double yOffset) => {
windows[window].onScroll (xOffset, yOffset);
/// <param name="dstOffset">an offset in the destination buffer for the copy operation.</param>
public void CopyTo (CommandBuffer cmd, Buffer buff, ulong size = 0, ulong srcOffset = 0, ulong dstOffset = 0) {
VkBufferCopy bufferCopy = new VkBufferCopy {
- size = (size == 0) ? AllocatedDeviceMemorySize : size,
+ size = (size == 0) ? createInfo.size : size,
srcOffset = srcOffset,
dstOffset = dstOffset
};
uint blockSize = blockW * blockH;
if (memoryProperty.HasFlag (VkMemoryPropertyFlags.DeviceLocal)) {
- ulong staggingSize = (ulong)ktxStream.Length + 256;//img.AllocatedDeviceMemorySize;
+ ulong staggingSize = img.AllocatedDeviceMemorySize;
Console.WriteLine ($"KtxStream size = {ktxStream.Length}, img Allocation = {img.AllocatedDeviceMemorySize}");
using (HostBuffer stagging = new HostBuffer (staggingQ.Dev, VkBufferUsageFlags.TransferSrc, staggingSize)) {
<PackageReference Include="SpirVTasks" Version="$(SpirVTasksPackageVersion)" />
<PackageReference Include="Vulkan" Version="0.2.3-beta" />
<PackageReference Include="shaderc.net" Version="0.1.0" />
- <PackageReference Include="glfw-sharp" Version="0.2.6-beta" />
+ <PackageReference Include="glfw-sharp" Version="0.2.10-beta" />
</ItemGroup>
<ItemGroup>