aboutsummaryrefslogtreecommitdiffstatsci
path: root/vke/src/ShaderInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'vke/src/ShaderInfo.cs')
-rw-r--r--vke/src/ShaderInfo.cs69
1 files changed, 69 insertions, 0 deletions
diff --git a/vke/src/ShaderInfo.cs b/vke/src/ShaderInfo.cs
new file mode 100644
index 0000000..f346195
--- /dev/null
+++ b/vke/src/ShaderInfo.cs
@@ -0,0 +1,69 @@
+//
+// FrameBuffer.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2019 jp
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using Vulkan;
+using static Vulkan.VulkanNative;
+
+namespace VKE {
+ public class ShaderInfo : IDisposable {
+ public VkShaderStageFlags StageFlags;
+ public string SpirvPath;
+ public FixedUtf8String EntryPoint;
+
+ public ShaderInfo (VkShaderStageFlags _stageFlags, string _spirvPath, string _entryPoint = "main") {
+ StageFlags = _stageFlags;
+ SpirvPath = _spirvPath;
+ EntryPoint = new FixedUtf8String (_entryPoint);
+ }
+
+ public VkPipelineShaderStageCreateInfo GetStageCreateInfo (Device dev) {
+ return new VkPipelineShaderStageCreateInfo {
+ sType = VkStructureType.PipelineShaderStageCreateInfo,
+ stage = StageFlags,
+ pName = EntryPoint,
+ module = dev.LoadSPIRVShader (SpirvPath),
+ };
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // Pour détecter les appels redondants
+
+ protected virtual void Dispose (bool disposing) {
+ if (!disposedValue) {
+ if (disposing)
+ EntryPoint.Dispose ();
+
+ disposedValue = true;
+ }
+ }
+ public void Dispose () {
+ Dispose (true);
+ }
+ #endregion
+ }
+}