public Query(QueryTarget t) { GL.GenQueries(1, out _index); _target = t; _use = true; _totalTimeElapsed = 0; }
/// <summary> /// Acquires an unused index for the given <see cref="QueryTarget"/>. /// </summary> /// <param name="target">The QueryTarget to acquire an index for.</param> /// <returns>Unused index.</returns> protected static int AcquireIndex(QueryTarget target) { if (!TargetIndices.ContainsKey(target)) { TargetIndices.Add(target, new SortedSet <int>()); } // find first free index var i = 0; foreach (var index in TargetIndices[target]) { if (index > i) { break; } i++; } if (!IndexableTargets.Contains(target) && i > 0) { throw new QueryException( string.Format("Query target not indexable and the single target it already in use: {0}", target)); } // remember index is in use TargetIndices[target].Add(i); return(i); }
public static void BeginQueryEXT(QueryTarget target, UInt32 id) { Debug.Assert(Delegates.pglBeginQueryEXT != null, "pglBeginQueryEXT not implemented"); Delegates.pglBeginQueryEXT((Int32)target, id); LogCommand("glBeginQueryEXT", null, target, id); DebugCheckErrors(null); }
/// <summary> /// glGetQueryiv returns in params a selected parameter of the query object target specified by target. /// Calling glGetQueryiv is equivalent to calling glGetQueryIndexediv with index set to zero. /// </summary> /// <param name="target">Specifies a query object target. Must be GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED, or GL_TIMESTAMP.</param> /// <param name="pname">Specifies the symbolic name of a query object target parameter. Accepted values are GL_CURRENT_QUERY or GL_QUERY_COUNTER_BITS.</param> /// <returns></returns> public static int GetQueryiv(QueryTarget target, GetQueryParameters pname) { int tmp = 0; Delegates.glGetQueryiv(target, pname, ref tmp); return(tmp); }
public static void QueryObjectParameterAMD(QueryTarget target, UInt32 id, Int32 pname, OcclusionQueryEventMaskAMD param) { Debug.Assert(Delegates.pglQueryObjectParameteruiAMD != null, "pglQueryObjectParameteruiAMD not implemented"); Delegates.pglQueryObjectParameteruiAMD((Int32)target, id, pname, (UInt32)param); LogCommand("glQueryObjectParameteruiAMD", null, target, id, pname, param); DebugCheckErrors(null); }
public static void EndQueryEXT(QueryTarget target) { Debug.Assert(Delegates.pglEndQueryEXT != null, "pglEndQueryEXT not implemented"); Delegates.pglEndQueryEXT((int)target); LogCommand("glEndQueryEXT", null, target); DebugCheckErrors(null); }
/// <summary> /// Gets the support queue of the thread with the threadID specified. /// </summary> /// <param name="threadID">The thread ID.</param> /// <param name="trans">The transaction currently in progress. Can be null if no transaction is in progress.</param> /// <returns> /// The requested supportqueue entity, or null if the thread isn't in a support queue. /// </returns> public static SupportQueueEntity GetQueueOfThread(int threadID, Transaction trans) { // the relation supportqueue - thread is stored in a SupportQueueThread entity. Use that entity as a filter for the support queue. If // that entity doesn't exist, the thread isn't in a supportqueue. var qf = new QueryFactory(); var q = qf.SupportQueueThread .From(QueryTarget.InnerJoin(qf.SupportQueue).On(SupportQueueThreadFields.QueueID == SupportQueueFields.QueueID)) .Where(SupportQueueThreadFields.ThreadID == threadID); // use a supportqueue collection to fetch the support queue, which will contain 0 or 1 entities after the fetch SupportQueueCollection supportQueues = new SupportQueueCollection(); // if a transaction has been specified, we've to add the collection to the transaction so the fetch takes place inside the same transaction so no // deadlocks occur on sqlserver if (trans != null) { trans.Add(supportQueues); } supportQueues.GetMulti(q); if (supportQueues.Count > 0) { // in a queue, return the instance return(supportQueues[0]); } else { // not in a queue, return null return(null); } }
public void CanTranslateEqualsToQueries() { var queryTarget = new QueryTarget { IntProp = 1, LongProp = 2, DecimalProp = 1.1m, BoolProp = true, Id = Guid.NewGuid(), DateTimeProp = DateTime.UtcNow, DateTimeOffsetProp = DateTimeOffset.UtcNow }; theSession.Store(queryTarget); theSession.SaveChanges(); var itemFromDb = theSession.Query <QueryTarget>() .Where(x => x.IntProp.Equals(queryTarget.IntProp)) .Where(x => x.LongProp.Equals(queryTarget.LongProp)) .Where(x => x.DecimalProp.Equals(queryTarget.DecimalProp)) .Where(x => x.BoolProp.Equals(queryTarget.BoolProp)) .Where(x => x.Id.Equals(queryTarget.Id)) .Where(x => x.DateTimeProp.Equals(queryTarget.DateTimeProp)) .Where(x => x.DateTimeOffsetProp.Equals(queryTarget.DateTimeOffsetProp)) .FirstOrDefault(); Assert.NotNull(itemFromDb); }
/// <summary> /// Begin query. /// <para>delimit the boundaries of a query object.</para> /// </summary> /// <param name="target">Specifies the target type of query object established between glBeginQuery and the subsequent glEndQuery.</param> public void BeginQuery(QueryTarget target) { if (!this.initialized) { this.Initialize(); } glBeginQuery((uint)target, this.Id); }
public CounterQueueEvent(CounterQueue queue, QueryTarget type) { _queue = queue; _counter = queue.GetQueryObject(); Type = type; _counter.Begin(); }
/// <summary> /// Gets an <see cref="IList{T}"/> of <see cref="TeamInRoundEntity"/>s matching the filter criteria. /// </summary> /// <param name="filter">The filter <see cref="IPredicateExpression"/> may contain <see cref="TeamInRoundFields"/> and <see cref="RoundFields"/>.</param> /// <param name="cancellationToken"></param> /// <returns>Returns an <see cref="IList{T}"/> of <see cref="TeamInRoundEntity"/>s matching the filter criteria.</returns> public virtual async Task <IList <TeamInRoundEntity> > GetTeamInRoundAsync(IPredicateExpression filter, CancellationToken cancellationToken) { using var da = _dbContext.GetNewAdapter(); var qf = new QueryFactory(); var q = qf.TeamInRound.From(QueryTarget.InnerJoin(qf.Round) .On(TeamInRoundFields.RoundId == RoundFields.Id)).Where(filter); return((IList <TeamInRoundEntity>) await da.FetchQueryAsync <TeamInRoundEntity>( q, cancellationToken)); }
/// <summary> /// Get the filtered employees using generated relations. /// </summary> /// <param name="qf">Query Factory object</param> /// <returns></returns> private static EntityQuery <EmployeeEntity> GetFilteredEmployeesUsingRelations(QueryFactory qf) { return(qf.Employee. From(QueryTarget. InnerJoin(EmployeeEntity.Relations.PersonEntityUsingBusinessEntityId)). Where(PersonFields.FirstName.StartsWith("A")). AndWhere(EmployeeFields.Gender == "M"). OrderBy(EmployeeFields.BusinessEntityId.Ascending()). Limit(5)); }
public CounterQueueEvent(CounterQueue queue, QueryTarget type, ulong drawIndex) { _queue = queue; _counter = queue.GetQueryObject(); Type = type; DrawIndex = drawIndex; _counter.Begin(); }
public static void BeginQuery(QueryTarget target, int id) { if (RenderSettings.CoreQuerySupported) { GL.BeginQuery(target, id); } else { GL.Arb.BeginQuery((ArbOcclusionQuery)(int)target, id); } }
public static void EndQuery(QueryTarget target) { if (RenderSettings.CoreQuerySupported) { GL.EndQuery(target); } else { GL.Arb.EndQuery((ArbOcclusionQuery)(int)target); } }
/// <summary> /// Get the filtered employees with prefetched Person entities /// </summary> /// <param name="qf">Query Factory object</param> /// <returns></returns> private static EntityQuery <EmployeeEntity> GetFilteredEmployeesWithPerson(QueryFactory qf) { return(qf.Employee. From(QueryTarget. InnerJoin(qf.Person).On(PersonFields.BusinessEntityId == EmployeeFields.BusinessEntityId)). Where(PersonFields.FirstName.StartsWith("A")). AndWhere(EmployeeFields.Gender == "M"). OrderBy(EmployeeFields.BusinessEntityId.Ascending()). Limit(5). WithPath(EmployeeEntity.PrefetchPathPerson)); }
public static void GetQueryEXT(QueryTarget target, QueryParameterName pname, out int @params) { unsafe { fixed(int *p_params = & @params) { Debug.Assert(Delegates.pglGetQueryivEXT != null, "pglGetQueryivEXT not implemented"); Delegates.pglGetQueryivEXT((int)target, (int)pname, p_params); LogCommand("glGetQueryivEXT", null, target, pname, @params); } } DebugCheckErrors(null); }
/// <summary> /// Begins the given query name. /// </summary> /// <param name="mapping">The query name to begin.</param> /// <param name="target">The query target to capture.</param> public void Begin(T mapping, QueryTarget target) { var map = _queries[mapping]; if (map.Active) { throw new QueryException(string.Format("Query already active: {0} {1}", target, mapping)); } map.Active = true; map.Target = target; map.Index = AcquireIndex(target); GL.BeginQueryIndexed(target, map.Index, map.Handle); }
/// <summary> /// Gets the message of the attachment with the attachmentid passed in. /// </summary> /// <param name="attachmentId">The attachment ID.</param> /// <returns>MessageEntity if found, otherwise null. MessageEntity has its Thread entity prefetched</returns> public static async Task <MessageEntity> GetMessageWithAttachmentLogicAsync(int attachmentId) { var qf = new QueryFactory(); var q = qf.Message .From(QueryTarget.InnerJoin(qf.Attachment).On(MessageFields.MessageID.Equal(AttachmentFields.MessageID))) .Where(AttachmentFields.AttachmentID.Equal(attachmentId)) .Limit(1) .WithPath(MessageEntity.PrefetchPathThread); using (var adapter = new DataAccessAdapter()) { return(await adapter.FetchFirstAsync(q).ConfigureAwait(false)); } }
/// <summary> /// Gets the message of the attachment with the attachmentid passed in. /// </summary> /// <param name="attachmentID">The attachment ID.</param> /// <returns>MessageEntity if found, otherwise null. MessageEntity has its Thread entity prefetched</returns> public static MessageEntity GetMessageWithAttachmentLogic(int attachmentID) { var qf = new QueryFactory(); var q = qf.Message .From(QueryTarget.InnerJoin(qf.Attachment).On(MessageFields.MessageID == AttachmentFields.MessageID)) .Where(AttachmentFields.AttachmentID == attachmentID) .Limit(1) .WithPath(MessageEntity.PrefetchPathThread); var messages = new MessageCollection(); messages.GetMulti(q); return((messages.Count > 0) ? messages[0] : null); }
private void UpdateAccumulatedCounter(CounterType type) { int handle = _queryObjects[(int)type]; QueryTarget target = GetTarget(type); GL.EndQuery(target); GL.GetQueryObject(handle, GetQueryObjectParam.QueryResult, out long result); _accumulatedCounters[(int)type] += (ulong)result; GL.BeginQuery(target, handle); }
public async Task <EntityCollection <LogEntity> > GetAllLogsWithUserAndProjectInfo() { var logs = new EntityCollection <LogEntity>(); using var adapter = new DataAccessAdapter(); var qf = new QueryFactory(); var q = qf.Log. From(QueryTarget. InnerJoin(LogEntity.Relations.ProjectEntityUsingProjectId) .InnerJoin(LogEntity.Relations.UserEntityUsingCreatedByUserId)) .OrderBy(LogFields.Id.Descending()).WithPath(LogEntity.PrefetchPathProject, LogEntity.PrefetchPathUser); return(await adapter.FetchQueryAsync(q, logs)); }
public BufferedQuery(QueryTarget type) { _buffer = GL.GenBuffer(); Query = GL.GenQuery(); _type = type; GL.BindBuffer(BufferTarget.QueryBuffer, _buffer); unsafe { long defaultValue = DefaultValue; GL.BufferStorage(BufferTarget.QueryBuffer, sizeof(long), (IntPtr)(&defaultValue), BufferStorageFlags.MapReadBit | BufferStorageFlags.MapWriteBit | BufferStorageFlags.MapPersistentBit); } _bufferMap = GL.MapBufferRange(BufferTarget.QueryBuffer, IntPtr.Zero, sizeof(long), BufferAccessMask.MapReadBit | BufferAccessMask.MapWriteBit | BufferAccessMask.MapPersistentBit); }
public async Task <EntityCollection <LogEntity> > GetCurrentUserLogs(int userId, int currentPage, int pageSize = 3) { var logs = new EntityCollection <LogEntity>(); using var adapter = new DataAccessAdapter(); var qf = new QueryFactory(); return(await adapter.FetchQueryAsync( qf.Log.Where(LogFields.CreatedByUserId == userId) .From(QueryTarget.InnerJoin(LogEntity.Relations.UserEntityUsingCreatedByUserId)) .WithPath(LogEntity.PrefetchPathUser) .OrderBy(LogFields.Id.Descending()) .Offset((currentPage - 1) * pageSize) .Limit(pageSize), logs)); }
/// <summary> /// Acquires an unused index for the given <see cref="QueryTarget"/>. /// </summary> /// <param name="target">The QueryTarget to acquire an index for.</param> /// <returns>Unused index.</returns> protected static int AcquireIndex(QueryTarget target) { if (!TargetIndices.ContainsKey(target)) TargetIndices.Add(target, new SortedSet<int>()); // find first free index var i = 0; foreach (var index in TargetIndices[target]) { if (index > i) break; i++; } if (!IndexableTargets.Contains(target) && i > 0) throw new QueryException( string.Format("Query target not indexable and the single target it already in use: {0}", target)); // remember index is in use TargetIndices[target].Add(i); return i; }
internal CounterQueue(CounterType type) { Type = type; QueryTarget glType = GetTarget(Type); _queryPool = new Queue <BufferedQuery>(QueryPoolInitialSize); for (int i = 0; i < QueryPoolInitialSize; i++) { _queryPool.Enqueue(new BufferedQuery(glType)); } _current = new CounterQueueEvent(this, glType, 0); _consumerThread = new Thread(EventConsumer); _consumerThread.Start(); }
/// <summary> /// Gets all customers who have bought the product with the product id specified. /// </summary> /// <param name="productId">The product id.</param> /// <returns>an entity collection with 0 or more customers who have purchased the product with the id specified</returns> public IEntityCollection2 GetAllCustomersFilteredOnProduct(int productId) { var qf = new QueryFactory(); var q = qf.Customer .From(QueryTarget .InnerJoin(qf.Order).On(CustomerFields.CustomerId == OrderFields.CustomerId) .InnerJoin(qf.OrderDetails).On(OrderFields.OrderId == OrderDetailsFields.OrderId)) .Where(OrderDetailsFields.ProductId == productId); var customers = new EntityCollection(new CustomerEntityFactory()); using (DataAccessAdapter adapter = new DataAccessAdapter()) { adapter.FetchQuery(q, customers); } return(customers); }
public async Task <IList <string> > GetRolesAsync(ApplicationUser user, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (var adapter = new DataAccessAdapter()) { var qf = new QueryFactory(); var q = qf.AspNetRole.From(QueryTarget .InnerJoin(AspNetUserRoleEntity.Relations.AspNetRoleEntityUsingRoleId)) .Where(AspNetUserRoleFields.UserId.Equal(user.Id)); var userRoles = await adapter.FetchQueryAsync(q, cancellationToken); return(userRoles.Cast <AspNetRoleEntity>().Select(ur => ur.NormalizedName).ToList()); } }
public async Task <IList <ApplicationUser> > GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (var adapter = new DataAccessAdapter()) { var qf = new QueryFactory(); var q = qf.AspNetUser.From(QueryTarget .InnerJoin(AspNetUserClaimEntity.Relations.AspNetUserEntityUsingUserId)) .Where(AspNetUserClaimFields.ClaimType.Equal(claim.Type) .And(AspNetUserClaimFields.ClaimValue.Equal(claim.Value))) .Select(ProjectionLambdaCreator.Create <ApplicationUser, AspNetUserFields>()); var users = await adapter.FetchQueryAsync(q, cancellationToken); return(users); } }
// // ListenToQuery(StructuredQuery query) // // Start listening to a query. I've not tried listening to multiple quries, your mileage may vary with that. public void ListenToQuery(StructuredQuery query) { var qt = new QueryTarget { }; qt.StructuredQuery = query; qt.Parent = string.Format("projects/{0}/databases/{1}/documents", ProjectId, DatabaseId); ListenRequest request = new ListenRequest { Database = new DatabaseRootName(ProjectId, DatabaseId).ToString(), AddTarget = new Target { Query = qt, } }; PendingRequests.Add(request); }
public async Task <IList <ApplicationUser> > GetUsersInRoleAsync(string roleName, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (var adapter = new DataAccessAdapter()) { var qf = new QueryFactory(); var q = qf.AspNetUser.From(QueryTarget .InnerJoin(AspNetRoleEntity.Relations.AspNetUserRoleEntityUsingRoleId) .InnerJoin(AspNetUserRoleEntity.Relations.AspNetUserEntityUsingUserId)) .Where(AspNetRoleFields.Name.Equal(roleName)) .AndWhere(AspNetUserRoleFields.RoleId.Equal(AspNetRoleFields.Id)) .Select(ProjectionLambdaCreator.Create <ApplicationUser, AspNetUserFields>()); var users = await adapter.FetchQueryAsync(q, cancellationToken); return(users); } }
public static void BeginQuery(QueryTarget target, uint id) { glBeginQuery deleg = BaseGraphicsContext.Current.Loader.Get<glBeginQuery>(); if (deleg != null) deleg(target, id); }
public static void GetQueryiv(QueryTarget target, GetQueryParam pname, int[] parameters) { glGetQueryiv deleg = BaseGraphicsContext.Current.Loader.Get<glGetQueryiv>(); if (deleg != null) deleg(target, pname, parameters); }
public void Begin(QueryTarget target) { Target = target; GL.BeginQuery(target, id); }
public static void EndQuery(QueryTarget target) { glEndQuery deleg = BaseGraphicsContext.Current.Loader.Get<glEndQuery>(); if (deleg != null) deleg(target); }
/// <summary> /// glBeginQueryIndexed and glEndQueryIndexed delimit the boundaries of a query object. query must be a name previously returned from a call to glGenQueries. If a query object with name id does not yet exist it is created with the type determined by target. target must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. The behavior of the query object depends on its type and is explained in QueryTarget enum. /// Querying the GL_QUERY_RESULT implicitly flushes the GL pipeline until the rendering delimited by the query object has completed and the result is available. GL_QUERY_RESULT_AVAILABLE can be queried to determine if the result is immediately available or if the rendering is not yet complete. /// </summary> /// <param name="target"></param> /// <param name="Index">index specifies the index of the query target and must be between a target-specific maximum.</param> /// <remarks> /// If the query target's count exceeds the maximum value representable in the number of available bits, as reported by glGetQueryiv with target set to the appropriate query target and pname GL_QUERY_COUNTER_BITS, the count becomes undefined. /// An implementation may support 0 bits in its counter, in which case query results are always undefined and essentially useless. /// When GL_SAMPLE_BUFFERS is 0, the samples-passed counter of an occlusion query will increment once for each fragment that passes the depth test. When GL_SAMPLE_BUFFERS is 1, an implementation may either increment the samples-passed counter individually for each sample of a fragment that passes the depth test, or it may choose to increment the counter for all samples of a fragment if any one of them passes the depth test. /// Calling glBeginQuery or glEndQuery is equivalent to calling glBeginQueryIndexed or glEndQueryIndexed with index set to zero, respectively. /// </remarks> public static void EndQueryIndexed(QueryTarget target, uint Index) { Delegates.glEndQueryIndexed(target, Index); }
//GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. //GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. GL_ANY_SAMPLES_PASSED_CONSERVATIVE, /// <summary> /// glBeginQueryIndexed and glEndQueryIndexed delimit the boundaries of a query object. query must be a name previously returned from a call to glGenQueries. If a query object with name id does not yet exist it is created with the type determined by target. target must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. The behavior of the query object depends on its type and is explained in QueryTarget enum. /// Querying the GL_QUERY_RESULT implicitly flushes the GL pipeline until the rendering delimited by the query object has completed and the result is available. GL_QUERY_RESULT_AVAILABLE can be queried to determine if the result is immediately available or if the rendering is not yet complete. /// </summary> /// <param name="target"></param> /// <param name="Index">index specifies the index of the query target and must be between a target-specific maximum.</param> /// <param name="QueryID"></param> /// <remarks> /// If the query target's count exceeds the maximum value representable in the number of available bits, as reported by glGetQueryiv with target set to the appropriate query target and pname GL_QUERY_COUNTER_BITS, the count becomes undefined. /// An implementation may support 0 bits in its counter, in which case query results are always undefined and essentially useless. /// When GL_SAMPLE_BUFFERS is 0, the samples-passed counter of an occlusion query will increment once for each fragment that passes the depth test. When GL_SAMPLE_BUFFERS is 1, an implementation may either increment the samples-passed counter individually for each sample of a fragment that passes the depth test, or it may choose to increment the counter for all samples of a fragment if any one of them passes the depth test. /// Calling glBeginQuery or glEndQuery is equivalent to calling glBeginQueryIndexed or glEndQueryIndexed with index set to zero, respectively. /// </remarks> public static void BeginQueryIndexed(QueryTarget target, uint Index, uint QueryID) { Delegates.glBeginQueryIndexed(target, Index, QueryID); }
/// <summary> /// glGetQueryIndexediv returns in params a selected parameter of the indexed query object target specified by target and index. /// </summary> /// <param name="target">Specifies a query object target. Must be GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED, or GL_TIMESTAMP.</param> /// <param name="Index">index specifies the index of the query object target and must be between zero and a target-specific maxiumum.</param> /// <param name="pname">Specifies the symbolic name of a query object target parameter. Accepted values are GL_CURRENT_QUERY or GL_QUERY_COUNTER_BITS.</param> /// <returns>Returns the requested data.</returns> /// <remarks> /// glGetQueryIndexediv returns in params a selected parameter of the indexed query object target specified by target and index. index specifies the index of the query object target and must be between zero and a target-specific maxiumum. /// pname names a specific query object target parameter. When pname is GL_CURRENT_QUERY, the name of the currently active query for the specified index of target, or zero if no query is active, will be placed in params. If pname is GL_QUERY_COUNTER_BITS, the implementation-dependent number of bits used to hold the result of queries for target is returned in params. /// The target GL_ANY_SAMPLES_PASSED_CONSERVATIVE is available only if the GL version is 4.3 or greater. /// If an error is generated, no change is made to the contents of params. /// Calling glGetQueryiv is equivalent to calling glGetQueryIndexediv with index set to zero. /// </remarks> public static int GetQueryIndexediv(QueryTarget target, uint Index, GetQueryIndexedParameters pname) { int tmp = 0; Delegates.glGetQueryIndexediv(target, Index, pname, ref tmp); return tmp; }
/// <summary> /// glGetQueryIndexediv returns in params a selected parameter of the indexed query object target specified by target and index. /// </summary> /// <param name="target">Specifies a query object target. Must be GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED, or GL_TIMESTAMP.</param> /// <param name="Index">index specifies the index of the query object target and must be between zero and a target-specific maxiumum.</param> /// <param name="pname">Specifies the symbolic name of a query object target parameter. Accepted values are GL_CURRENT_QUERY or GL_QUERY_COUNTER_BITS.</param> /// <param name="params">Returns the requested data.</param> /// <remarks> /// glGetQueryIndexediv returns in params a selected parameter of the indexed query object target specified by target and index. index specifies the index of the query object target and must be between zero and a target-specific maxiumum. /// pname names a specific query object target parameter. When pname is GL_CURRENT_QUERY, the name of the currently active query for the specified index of target, or zero if no query is active, will be placed in params. If pname is GL_QUERY_COUNTER_BITS, the implementation-dependent number of bits used to hold the result of queries for target is returned in params. /// The target GL_ANY_SAMPLES_PASSED_CONSERVATIVE is available only if the GL version is 4.3 or greater. /// If an error is generated, no change is made to the contents of params. /// Calling glGetQueryiv is equivalent to calling glGetQueryIndexediv with index set to zero. /// </remarks> public static void GetQueryIndexediv(QueryTarget target, uint Index, GetQueryIndexedParameters pname, int[] @params) { Delegates.glGetQueryIndexediv(target, Index, pname, ref @params[0]); }
/// <summary> /// glGetQueryiv returns in params a selected parameter of the query object target specified by target. /// Calling glGetQueryiv is equivalent to calling glGetQueryIndexediv with index set to zero. /// </summary> /// <param name="target">Specifies a query object target. Must be GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED, or GL_TIMESTAMP.</param> /// <param name="pname">Specifies the symbolic name of a query object target parameter. Accepted values are GL_CURRENT_QUERY or GL_QUERY_COUNTER_BITS.</param> /// <returns></returns> public static int GetQueryiv(QueryTarget target, GetQueryParameters pname) { int tmp = 0; Delegates.glGetQueryiv(target, pname, ref tmp); return tmp; }
/// <summary> /// Een query. /// </summary> /// <param name="target">Specifies the target type of query object to be concluded.s</param> public void EndQuery(QueryTarget target) { glEndQuery((uint)target); }
/// <summary> /// Releases a previously acquired index for the given <see cref="QueryTarget"/>. /// </summary> /// <param name="target">The QueryTarget to release the index from.</param> /// <param name="index">The index to release.</param> protected static void ReleaseIndex(QueryTarget target, int index) { TargetIndices[target].Remove(index); }
/// <summary> /// glBeginQuery and glEndQuery delimit the boundaries of a query object. query must be a name previously returned from a call to glGenQueries. If a query object with name id does not yet exist it is created with the type determined by target. target must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. /// Calling glBeginQuery or glEndQuery is equivalent to calling glBeginQueryIndexed or glEndQueryIndexed with index set to zero, respectively. /// </summary> /// <param name="target">Specifies the target type of query object to be concluded. The symbolic constant must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED.</param> public static void EndQuery(QueryTarget target) { Delegates.glEndQuery(target); }
/// <summary> /// glGetQueryiv returns in params a selected parameter of the query object target specified by target. /// Calling glGetQueryiv is equivalent to calling glGetQueryIndexediv with index set to zero. /// </summary> /// <param name="target">Specifies a query object target. Must be GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED_CONSERVATIVE GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_TIME_ELAPSED, or GL_TIMESTAMP.</param> /// <param name="pname">Specifies the symbolic name of a query object target parameter. Accepted values are GL_CURRENT_QUERY or GL_QUERY_COUNTER_BITS.</param> /// <param name="params"></param> public static void GetQueryiv(QueryTarget target, GetQueryParameters pname, int[] @params) { Delegates.glGetQueryiv(target, pname, ref @params[0]); }
/// <summary> /// Begin query. /// <para>delimit the boundaries of a query object.</para> /// </summary> /// <param name="target">Specifies the target type of query object established between glBeginQuery and the subsequent glEndQuery.</param> public void BeginQuery(QueryTarget target) { if (!this.initialized) { this.Initialize(); } glBeginQuery((uint)target, this.Id); }
/// <summary> /// glBeginQuery and glEndQuery delimit the boundaries of a query object. query must be a name previously returned from a call to glGenQueries. If a query object with name id does not yet exist it is created with the type determined by target. target must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. /// Calling glBeginQuery or glEndQuery is equivalent to calling glBeginQueryIndexed or glEndQueryIndexed with index set to zero, respectively. /// </summary> /// <param name="target">Specifies the target type of query object established between glBeginQuery and the subsequent glEndQuery. The symbolic constant must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED.</param> /// <param name="QueryID">Specifies the name of a query object.</param> public static void BeginQuery(QueryTarget target, uint QueryID) { Delegates.glBeginQuery(target, QueryID); }