<commit_before>﻿using System;
using System.Collections.Generic;

namespace CSGL.Vulkan {
    public class ImageCreateInfo {

    }

    public class Image : IDisposable, INative<VkImage> {
        VkImage image;
        bool disposed = false;

        public Device Device { get; private set; }

        public VkImage Native {
            get {
                return image;
            }
        }

        internal Image(Device device, VkImage image) { //for images that are implicitly created, eg a swapchains's images
            Device = device;
            this.image = image;
        }

        //public Image(Device device, ImageCreateInfo info) {
        //    Device = device;
        //}

        public void Dispose() {
            if (disposed) return;

            disposed = true;
        }
    }
}<commit_msg>Added public constructor to Image class<commit_after>﻿using System;
using System.Collections.Generic;

namespace CSGL.Vulkan {
    public class ImageCreateInfo {
        public VkImageCreateFlags flags;
        public VkImageType imageType;
        public VkFormat format;
        public VkExtent3D extent;
        public uint mipLevels;
        public uint arrayLayers;
        public VkSampleCountFlags samples;
        public VkImageTiling tiling;
        public VkImageUsageFlags usage;
        public VkSharingMode sharingMode;
        public uint[] queueFamilyIndices;
        public VkImageLayout initialLayout;
    }

    public class Image : IDisposable, INative<VkImage> {
        VkImage image;
        bool disposed = false;

        public Device Device { get; private set; }

        public VkImage Native {
            get {
                return image;
            }
        }

        internal Image(Device device, VkImage image) { //for images that are implicitly created, eg a swapchains's images
            Device = device;
            this.image = image;
        }

        public Image(Device device, ImageCreateInfo info) {
            if (device == null) throw new ArgumentNullException(nameof(device));
            Device = device;
        }

        void CreateImage(ImageCreateInfo mInfo) {
            var info = new VkImageCreateInfo();
            info.sType = VkStructureType.StructureTypeImageCreateInfo;
            info.flags = mInfo.flags;
            info.imageType = mInfo.imageType;
            info.format = mInfo.format;
            info.extent = mInfo.extent;
            info.mipLevels = mInfo.mipLevels;
            info.arrayLayers = mInfo.arrayLayers;
            info.samples = mInfo.samples;
            info.tiling = mInfo.tiling;
            info.usage = mInfo.usage;
            info.sharingMode = mInfo.sharingMode;

            var indicesMarshalled = new PinnedArray<uint>(mInfo.queueFamilyIndices);
            info.queueFamilyIndexCount = (uint)indicesMarshalled.Length;
            info.pQueueFamilyIndices = indicesMarshalled.Address;
            info.initialLayout = mInfo.initialLayout;

            try {
                var result = Device.Commands.createImage(Device.Native, ref info, Device.Instance.AllocationCallbacks, out image);
                if (result != VkResult.Success) throw new ImageException(string.Format("Error creating image: {0}", result));
            }
            finally {
                indicesMarshalled.Dispose();
            }
        }

        public void Dispose() {
            if (disposed) return;

            disposed = true;
        }
    }

    public class ImageException : Exception {
        public ImageException(string message) : base(message) { }
    }
}
{'fraction_non_alphanumeric': 0.07552954292084726, 'fraction_numerical': 0.0005574136008918618, 'mean_word_length': 1.906072874493927, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5428571', 'n_tokens_mistral': 961, 'n_tokens_neox': 922, 'n_words': 245}