Beispiel #1
0
        public void CreateQueryPool()
        {
            var createInfo = new QueryPoolCreateInfo(QueryType.Timestamp, 1);

            using (Device.CreateQueryPool(createInfo)) { }
            using (Device.CreateQueryPool(createInfo, CustomAllocator)) { }
        }
Beispiel #2
0
        public unsafe BufferedQuery(VulkanRenderer gd, Device device, PipelineFull pipeline, CounterType type, bool result32Bit)
        {
            _api         = gd.Api;
            _device      = device;
            _pipeline    = pipeline;
            _type        = type;
            _result32Bit = result32Bit;

            _isSupported = QueryTypeSupported(gd, type);

            if (_isSupported)
            {
                QueryPipelineStatisticFlags flags = type == CounterType.PrimitivesGenerated ?
                                                    QueryPipelineStatisticFlags.QueryPipelineStatisticGeometryShaderPrimitivesBit : 0;

                var queryPoolCreateInfo = new QueryPoolCreateInfo()
                {
                    SType              = StructureType.QueryPoolCreateInfo,
                    QueryCount         = 1,
                    QueryType          = GetQueryType(type),
                    PipelineStatistics = flags
                };

                gd.Api.CreateQueryPool(device, queryPoolCreateInfo, null, out _queryPool).ThrowOnError();
            }

            var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true);

            _bufferMap    = buffer.Map(0, sizeof(long));
            _defaultValue = result32Bit ? DefaultValueInt : DefaultValue;
            Marshal.WriteInt64(_bufferMap, _defaultValue);
            _buffer = buffer;
        }
Beispiel #3
0
        private unsafe void Recreate()
        {
            var createInfo = new QueryPoolCreateInfo
            {
                StructureType = StructureType.QueryPoolCreateInfo,
                QueryCount    = (uint)QueryCount,
            };

            switch (QueryType)
            {
            case QueryType.Timestamp:
                createInfo.QueryType = SharpVulkan.QueryType.Timestamp;
                break;

            default:
                throw new NotImplementedException();
            }

            NativeQueryPool = GraphicsDevice.NativeDevice.CreateQueryPool(ref createInfo);
        }
Beispiel #4
0
        public unsafe BufferedQuery(VulkanGraphicsDevice gd, Device device, PipelineFull pipeline, CounterType type)
        {
            _api      = gd.Api;
            _device   = device;
            _pipeline = pipeline;

            var queryPoolCreateInfo = new QueryPoolCreateInfo()
            {
                SType      = StructureType.QueryPoolCreateInfo,
                QueryCount = 1,
                QueryType  = GetQueryType(type)
            };

            gd.Api.CreateQueryPool(device, queryPoolCreateInfo, null, out _queryPool).ThrowOnError();

            var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true);

            _bufferMap = buffer.Map(0, sizeof(long));
            Marshal.WriteInt64(_bufferMap, -1L);
            _buffer = buffer;
        }
Beispiel #5
0
 public unsafe QueryPool CreateQueryPool(ref QueryPoolCreateInfo createInfo, AllocationCallbacks* allocator = null)
 {
     QueryPool queryPool;
     fixed (QueryPoolCreateInfo* __createInfo__ = &createInfo)
     {
         vkCreateQueryPool(this, __createInfo__, allocator, &queryPool).CheckError();
     }
     return queryPool;
 }
Beispiel #6
0
 internal static unsafe extern Result vkCreateQueryPool(Device device, QueryPoolCreateInfo* createInfo, AllocationCallbacks* allocator, QueryPool* queryPool);