Example #1
0
        internal VulkanGraphicsFence(VulkanGraphicsDevice device)
            : base(device)
        {
            _vulkanFence = new ValueLazy <VkFence>(CreateVulkanFence);

            _ = _state.Transition(to: Initialized);
        }
Example #2
0
        internal VulkanGraphicsPipeline(VulkanGraphicsDevice device, VulkanGraphicsPipelineSignature signature, VulkanGraphicsShader?vertexShader, VulkanGraphicsShader?pixelShader)
            : base(device, signature, vertexShader, pixelShader)
        {
            _vulkanPipeline = new ValueLazy <VkPipeline>(CreateVulkanPipeline);

            _ = _state.Transition(to: Initialized);
        }
        internal VulkanGraphicsBuffer(VulkanGraphicsDevice graphicsDevice, GraphicsBufferKind kind, ulong size, ulong stride)
            : base(graphicsDevice, kind, size, stride)
        {
            _vulkanBuffer       = new ValueLazy <VkBuffer>(CreateVulkanBuffer);
            _vulkanDeviceMemory = new ValueLazy <VkDeviceMemory>(CreateVulkanDeviceMemory);

            _ = _state.Transition(to: Initialized);
        }
Example #4
0
        internal VulkanGraphicsPipelineSignature(VulkanGraphicsDevice graphicsDevice, ReadOnlySpan <GraphicsPipelineInput> inputs, ReadOnlySpan <GraphicsPipelineResource> resources)
            : base(graphicsDevice, inputs, resources)
        {
            _vulkanDescriptorPool      = new ValueLazy <VkDescriptorPool>(CreateVulkanDescriptorPool);
            _vulkanDescriptorSet       = new ValueLazy <VkDescriptorSet>(CreateVulkanDescriptorSet);
            _vulkanDescriptorSetLayout = new ValueLazy <VkDescriptorSetLayout>(CreateVulkanDescriptorSetLayout);
            _vulkanPipelineLayout      = new ValueLazy <VkPipelineLayout>(CreateVulkanPipelineLayout);

            _ = _state.Transition(to: Initialized);
        }
Example #5
0
            static VulkanGraphicsContext[] CreateGraphicsContexts(VulkanGraphicsDevice graphicsDevice, int graphicsContextCount)
            {
                var graphicsContexts = new VulkanGraphicsContext[graphicsContextCount];

                for (var index = 0; index < graphicsContexts.Length; index++)
                {
                    graphicsContexts[index] = new VulkanGraphicsContext(graphicsDevice, index);
                }

                return(graphicsContexts);
            }
Example #6
0
            static VulkanGraphicsContext[] CreateGraphicsContexts(VulkanGraphicsDevice device, int contextCount)
            {
                var contexts = new VulkanGraphicsContext[contextCount];

                for (var index = 0; index < contexts.Length; index++)
                {
                    contexts[index] = new VulkanGraphicsContext(device, index);
                }

                return contexts;
            }
        internal VulkanGraphicsContext(VulkanGraphicsDevice device, int index)
            : base(device, index)
        {
            _fence = new VulkanGraphicsFence(device);
            _waitForExecuteCompletionFence = new VulkanGraphicsFence(device);

            _vulkanCommandBuffer      = new ValueLazy <VkCommandBuffer>(CreateVulkanCommandBuffer);
            _vulkanCommandPool        = new ValueLazy <VkCommandPool>(CreateVulkanCommandPool);
            _vulkanFramebuffer        = new ValueLazy <VkFramebuffer>(CreateVulkanFramebuffer);
            _vulkanSwapChainImageView = new ValueLazy <VkImageView>(CreateVulkanSwapChainImageView);

            _ = _state.Transition(to: Initialized);
        }
Example #8
0
        internal VulkanGraphicsShader(VulkanGraphicsDevice device, GraphicsShaderKind kind, ReadOnlySpan <byte> bytecode, string entryPointName)
            : base(device, kind, entryPointName)
        {
            var bytecodeLength = (nuint)bytecode.Length;

            _vulkanShaderModuleCreateInfo.sType    = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
            _vulkanShaderModuleCreateInfo.codeSize = bytecodeLength;
            _vulkanShaderModuleCreateInfo.pCode    = (uint *)Allocate(bytecodeLength);

            var destination = new Span <byte>(_vulkanShaderModuleCreateInfo.pCode, (int)bytecodeLength);

            bytecode.CopyTo(destination);

            _vulkanShaderModule = new ValueLazy <VkShaderModule>(CreateVulkanShaderModule);

            _ = _state.Transition(to: Initialized);
        }
        internal VulkanGraphicsMemoryAllocator(VulkanGraphicsDevice device, ulong blockPreferredSize)
            : base(device, blockPreferredSize)
        {
            blockPreferredSize = BlockPreferredSize;

            var blockMinimumSize = blockPreferredSize >> 3;

            if (blockMinimumSize == 0)
            {
                blockMinimumSize = blockPreferredSize;
            }

            var memoryTypeCount = Device.Adapter.VulkanPhysicalDeviceMemoryProperties.memoryTypeCount;

            _blockCollections = new VulkanGraphicsMemoryBlockCollection[memoryTypeCount];

            for (uint memoryTypeIndex = 0; memoryTypeIndex < memoryTypeCount; memoryTypeIndex++)
            {
                _blockCollections[memoryTypeIndex] = new VulkanGraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, memoryTypeIndex);
            }

            // TODO: UpdateBudget
            _ = _state.Transition(to: Initialized);
        }
Example #10
0
 internal VulkanGraphicsPrimitive(VulkanGraphicsDevice graphicsDevice, VulkanGraphicsPipeline graphicsPipeline, VulkanGraphicsBuffer vertexBuffer, VulkanGraphicsBuffer?indexBuffer, ReadOnlySpan <GraphicsBuffer> inputBuffers = default)
     : base(graphicsDevice, graphicsPipeline, vertexBuffer, indexBuffer, inputBuffers)
 {
     _ = _state.Transition(to: Initialized);
 }
Example #11
0
 internal VulkanGraphicsHeap(VulkanGraphicsDevice graphicsDevice, ulong size, GraphicsHeapCpuAccess cpuAccess)
     : base(graphicsDevice, size, cpuAccess)
 {
     _vulkanDeviceMemory = new ValueLazy <VkDeviceMemory>(CreateVulkanDeviceMemory);
     _ = _state.Transition(to: Initialized);
 }
 internal VulkanGraphicsPrimitive(VulkanGraphicsDevice device, VulkanGraphicsPipeline pipeline, in GraphicsBufferView vertexBufferView, in GraphicsBufferView indexBufferView, ReadOnlySpan <GraphicsResource> inputResources = default)