예제 #1
0
        void CreateShader(ShaderModuleCreateInfo mInfo)
        {
            VkShaderModuleCreateInfo info = new VkShaderModuleCreateInfo();

            info.sType    = VkStructureType.ShaderModuleCreateInfo;
            info.codeSize = (ulong)mInfo.Data.LongLength;

            var dataPinned = new PinnedArray <byte>(mInfo.Data);

            info.pCode = dataPinned.Address;

            using (dataPinned) {
                var result = createShaderModule(device.Native, ref info, device.Instance.AllocationCallbacks, out shaderModule);
                if (result != VkResult.Success)
                {
                    throw new ShaderModuleException(string.Format("Error creating shader module: {0}"));
                }
            }
        }
예제 #2
0
        public ShaderModule(Device device, ShaderModuleCreateInfo info)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }
            if (info.Data == null)
            {
                throw new ArgumentNullException(nameof(info.Data));
            }

            this.device = device;

            createShaderModule  = device.Commands.createShaderModule;
            destroyShaderModule = device.Commands.destroyShaderModule;

            CreateShader(info);
        }