Ejemplo n.º 1
0
        private ShaderModule LoadShaderModule(string filename)
        {
            byte[] data = File.ReadAllBytes(filename);

            fixed(byte *pData = data)
            {
                ShaderModuleCreateInfo createInfo = new ShaderModuleCreateInfo
                {
                    SType    = StructureType.ShaderModuleCreateInfo,
                    CodeSize = new UIntPtr((uint)data.Length),
                    PCode    = (uint *)pData
                };

                ShaderModule module;
                var          res = VkApi.CreateShaderModule(this.Device, &createInfo, null, &module);

                if (res != Result.Success)
                {
                    throw new VMASharp.VulkanResultException("Failed to create Shader Module!", res);
                }

                return(module);
            }
        }