Пример #1
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;
        }
Пример #2
0
 public QueryPoolCreateInfo
 (
     StructureType sType = StructureType.QueryPoolCreateInfo,
     void *pNext         = default,
     uint flags          = default,
     QueryType queryType = default,
     uint queryCount     = default,
     QueryPipelineStatisticFlags pipelineStatistics = default
 )
 {
     SType              = sType;
     PNext              = pNext;
     Flags              = flags;
     QueryType          = queryType;
     QueryCount         = queryCount;
     PipelineStatistics = pipelineStatistics;
 }
 public CommandBufferInheritanceInfo
 (
     StructureType sType          = StructureType.CommandBufferInheritanceInfo,
     void *pNext                  = default,
     RenderPass renderPass        = default,
     uint subpass                 = default,
     Framebuffer framebuffer      = default,
     Bool32 occlusionQueryEnable  = default,
     QueryControlFlags queryFlags = default,
     QueryPipelineStatisticFlags pipelineStatistics = default
 )
 {
     SType                = sType;
     PNext                = pNext;
     RenderPass           = renderPass;
     Subpass              = subpass;
     Framebuffer          = framebuffer;
     OcclusionQueryEnable = occlusionQueryEnable;
     QueryFlags           = queryFlags;
     PipelineStatistics   = pipelineStatistics;
 }