示例#1
0
        internal QueryHeap(ComputeDevice device, QueryHeapType type, int numQueries)
        {
            _device    = device;
            _nextQuery = 0;

            if (type == QueryHeapType.CopyTimestamp &&
                _device.QueryFeatureSupport <D3D12_FEATURE_DATA_D3D12_OPTIONS3>(D3D12_FEATURE.D3D12_FEATURE_D3D12_OPTIONS3).CopyQueueTimestampQueriesSupported != TRUE)
            {
                ThrowHelper.ThrowNotSupportedException("Device does not support copy queue timestamps");
            }

            var desc = new D3D12_QUERY_HEAP_DESC
            {
                Count    = (uint)numQueries,
                Type     = (D3D12_QUERY_HEAP_TYPE)type,
                NodeMask = 0, // TODO: MULTI-GPU
            };

            _queryHeap  = device.CreateQueryHeap(desc);
            _numQueries = (uint)numQueries;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryHeapDescription"/> struct.
 /// </summary>
 /// <param name="type">The <see cref="QueryHeapType"/> type.</param>
 /// <param name="count">Specifies the number of queries the heap should contain.</param>
 /// <param name="nodeMask">For single GPU operation, set this to zero. If there are multiple GPU nodes, set a bit to identify the node (the device's physical adapter) to which the query heap applies.</param>
 public QueryHeapDescription(QueryHeapType type, int count, int nodeMask = 0)
 {
     Type     = type;
     Count    = count;
     NodeMask = nodeMask;
 }