//private GltfTextureContainer AllocateTextures(int bucketSize, Texture[] textures, GltfImageData[] images) //{ // return new GltfTextureContainer // { // BucketSize = bucketSize, // }; //} private IMgSampler[] ExtractSamplers(IMgDevice device, Sampler[] samplers) { var noOfSamplers = samplers != null ? samplers.Length : 0; var output = new IMgSampler[noOfSamplers]; for (var i = 0; i < noOfSamplers; i += 1) { var src = samplers[i]; var createInfo = new MgSamplerCreateInfo { AddressModeU = GetAddressModeU(src.WrapS), AddressModeV = GetAddressModeV(src.WrapT), MinFilter = GetMinFilter(src.MinFilter), MagFilter = GetMagFilter(src.MagFilter), MipmapMode = GetMipmapMode(src.MinFilter), }; var err = device.CreateSampler(createInfo, null, out IMgSampler pSampler); if (err != Result.SUCCESS) { throw new InvalidOperationException(); } output[i] = pSampler; } return(output); }
public void Destroy(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } if (Blocks != null) { foreach (var block in Blocks) { if (block != null) { if (block.DeviceMemory != null) { block.DeviceMemory.FreeMemory(device, allocator); } if (block.Buffer != null) { block.Buffer.DestroyBuffer(device, allocator); } } } } mIsDisposed = true; }
public BufferInfo(IMgThreadPartition partition, MgBufferUsageFlagBits usage, MgMemoryPropertyFlagBits propertyFlags, uint bufferSize) { Debug.Assert(partition != null); mDevice = partition.Device; Debug.Assert(mDevice != null); mUsageFlags = usage; mMemoryPropertyFlags = propertyFlags; var bufferCreateInfo = new MgBufferCreateInfo { Usage = usage, Size = bufferSize, }; IMgBuffer buffer; var device = partition.Device; var result = device.CreateBuffer(bufferCreateInfo, null, out buffer); Debug.Assert(result == Result.SUCCESS); MgMemoryRequirements memReqs; device.GetBufferMemoryRequirements(buffer, out memReqs); mAlignment = memReqs.Alignment; mBufferSize = memReqs.Size; uint memoryTypeIndex; partition.GetMemoryType(memReqs.MemoryTypeBits, mMemoryPropertyFlags, out memoryTypeIndex); var memAlloc = new MgMemoryAllocateInfo { MemoryTypeIndex = memoryTypeIndex, AllocationSize = memReqs.Size, }; IMgDeviceMemory deviceMemory; result = device.AllocateMemory(memAlloc, null, out deviceMemory); Debug.Assert(result == Result.SUCCESS); buffer.BindBufferMemory(device, deviceMemory, 0); mBuffer = buffer; mDeviceMemory = deviceMemory; mDescriptor = new MgDescriptorBufferInfo { Buffer = mBuffer, Offset = 0, Range = mBufferSize, }; }
public MgQueueInfo(uint queueIndex, IMgPhysicalDevice gpu, IMgDevice device, uint queueFamilyIndex, IMgQueue queue) { QueueIndex = queueIndex; QueueFamilyIndex = queueFamilyIndex; mParent = gpu; Device = device; Queue = queue; }
internal void Initialize(IMgDevice device, SceneMeshPrimitive[] meshPrimitives, MgtfMaterial[] materials) { Variants = new EffectPipelineDictionary(); foreach (var eff in Effects) { InitializeVariants(device, eff, meshPrimitives, materials); } }
public void DestroySemaphore(IMgDevice device, IMgAllocationCallbacks allocator) { if (ObjectPtr != IntPtr.Zero) { GL.DeleteSync(ObjectPtr); ObjectPtr = IntPtr.Zero; } }
public void Clear(IMgDevice device) { foreach (var entry in mVariants.Values) { entry.Pipeline.DestroyPipeline(device, null); } mVariants.Clear(); }
public Result ResetDescriptorPool(IMgDevice device, uint flags) { for (var i = 0; i < PoolSize; ++i) { AttachedSets[i].Reset(); } return(Result.SUCCESS); }
public Result ResetCommandPool(IMgDevice device, MgCommandPoolResetFlagBits flags) { foreach (var buffer in mBuffers) { buffer.ResetAllData(); } return(Result.SUCCESS); }
public EffectLayout CreateEffectLayout(IMgDevice device) { var pDsCreateInfo = new MgDescriptorSetLayoutCreateInfo { Bindings = new[] { // WORLD DATA // CAMERAS // LIGHTS new MgDescriptorSetLayoutBinding { Binding = 0, DescriptorType = MgDescriptorType.UNIFORM_BUFFER, DescriptorCount = 1, StageFlags = MgShaderStageFlagBits.VERTEX_BIT, }, // MATERIALS new MgDescriptorSetLayoutBinding { Binding = 1, DescriptorType = MgDescriptorType.UNIFORM_BUFFER, DescriptorCount = mSettings.NoOfMaterialsPerGroup, StageFlags = MgShaderStageFlagBits.FRAGMENT_BIT, }, // TEXTURES new MgDescriptorSetLayoutBinding { Binding = 5, DescriptorType = MgDescriptorType.COMBINED_IMAGE_SAMPLER, DescriptorCount = mSettings.NoOfTexturesPerGroup, StageFlags = MgShaderStageFlagBits.FRAGMENT_BIT, }, } }; var err = device.CreateDescriptorSetLayout(pDsCreateInfo, null, out IMgDescriptorSetLayout dsLayout); if (err != Result.SUCCESS) { throw new InvalidOperationException("CreateDescriptorSetLayout failed"); } var pCreateInfo = new MgPipelineLayoutCreateInfo { SetLayouts = new[] { dsLayout, } }; err = device.CreatePipelineLayout(pCreateInfo, null, out IMgPipelineLayout layout); if (err != Result.SUCCESS) { throw new InvalidOperationException("CreatePipelineLayout failed"); } return(new EffectLayout(dsLayout, layout)); }
public void DestroyCommandPool(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mIsDisposed = true; }
public void DestroyDescriptorSetLayout(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mIsDisposed = true; }
public Result ResetDescriptorPool(IMgDevice device, UInt32 flags) { Debug.Assert(!mIsDisposed); var bDevice = device as VkDevice; Debug.Assert(bDevice != null); return(Interops.vkResetDescriptorPool(bDevice.Handle, this.Handle, flags)); }
public Result BindImageMemory(IMgDevice device, IMgDeviceMemory memory, ulong memoryOffset) { var deviceMemory = memory as IGLDeviceMemory; if (deviceMemory != null) { mMemory = IntPtr.Add(deviceMemory.Handle, (int)memoryOffset); } return(Result.SUCCESS); }
public Result ResetEvent(IMgDevice device) { Debug.Assert(!mIsDisposed); var bDevice = (VkDevice)device; Debug.Assert(bDevice != null); return((Result)Interops.vkResetEvent(bDevice.Handle, this.Handle)); }
public void UnmapMemory(IMgDevice device) { if (!mIsHostCached && mIsMapped) { bool isValid = GL.Ext.UnmapNamedBuffer(mBufferId); mErrHandler.LogGLError("GL.Ext.UnmapNamedBuffer"); } mIsMapped = false; }
public void UnmapMemory(IMgDevice device) { Debug.Assert(!mIsDisposed); if (mRange.HasValue) { InternalBuffer.DidModify(mRange.Value); mRange = null; } }
public void DestroyDescriptorPool(IMgDevice device, IMgAllocationCallbacks allocator) { foreach (var img in CombinedImageSamplers.Items) { if (img != null) { img.Destroy(); } } }
public void UnmapMemory(IMgDevice device) { Debug.Assert(!mIsDisposed); var bDevice = (VkDevice)device; Debug.Assert(bDevice != null); Interops.vkUnmapMemory(bDevice.Handle, this.Handle); }
public Result GetEventStatus(IMgDevice device) { Debug.Assert(!mIsDisposed); var bDevice = (VkDevice)device; Debug.Assert(bDevice != null); return(Interops.vkGetEventStatus(bDevice.Handle, this.Handle)); }
public Result ResetCommandPool(IMgDevice device, MgCommandPoolResetFlagBits flags) { Debug.Assert(!mIsDisposed); var bDevice = (VkDevice)device; Debug.Assert(bDevice != null); return(Interops.vkResetCommandPool(bDevice.Handle, this.Handle, (VkCommandPoolResetFlags)flags)); }
public void DestroyImageView(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mIsDisposed = true; }
public void FreeMemory(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } InternalBuffer = null; mIsDisposed = true; }
public void DestroyBuffer(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } VertexBuffer = null; mIsDisposed = true; }
public void DestroySampler(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mEntrypoint.DeleteSampler(SamplerId); mIsDisposed = true; }
public void DestroyImage(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mEntrypoint.DeleteImage(mTextureId); //GL.DeleteTexture (mTextureId); mIsDisposed = true; }
public MgThreadPartition( IMgPhysicalDevice physicalDevice, IMgDevice device, IMgQueue queue, IMgCommandPool commandPool, MgPhysicalDeviceMemoryProperties deviceMemoryProperties) { mPhysicalDevice = physicalDevice; mDevice = device; this.Queue = queue; this.CommandPool = commandPool; mDeviceMemoryProperties = deviceMemoryProperties; }
public void DestroyPipeline(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mEntrypoint.DeleteProgram(ProgramID); //GL.DeleteProgram (ProgramID); mIsDisposed = true; }
public void Destroy(IMgDevice device) { if (Layout != null) { Layout.DestroyPipelineLayout(device, null); } if (DescriptorSetLayout != null) { DescriptorSetLayout.DestroyDescriptorSetLayout(device, null); } }
public void DestroyImageView(IMgDevice device, IMgAllocationCallbacks allocator) { if (mIsDisposed) { return; } mModule.DeleteImageView(TextureId); // int textureId = TextureId; // GL.DeleteTextures (1, ref textureId); mIsDisposed = true; }