Esempio n. 1
0
        public bool TryHostConditionalRendering(ICounterEvent value, ulong compare, bool isEqual)
        {
            if (value is CounterQueueEvent)
            {
                // Compare an event and a constant value.
                CounterQueueEvent evt = (CounterQueueEvent)value;

                // Easy host conditional rendering when the check matches what GL can do:
                //  - Event is of type samples passed.
                //  - Result is not a combination of multiple queries.
                //  - Comparing against 0.
                //  - Event has not already been flushed.

                if (evt.Disposed)
                {
                    // If the event has been flushed, then just use the values on the CPU.
                    // The query object may already be repurposed for another draw (eg. begin + end).
                    return(false);
                }

                if (compare == 0 && evt.Type == QueryTarget.SamplesPassed && evt.ClearCounter)
                {
                    GL.BeginConditionalRender(evt.Query, isEqual ? ConditionalRenderType.QueryNoWaitInverted : ConditionalRenderType.QueryNoWait);
                    return(true);
                }
            }

            // The GPU will flush the queries to CPU and evaluate the condition there instead.

            GL.Flush(); // The thread will be stalled manually flushing the counter, so flush GL commands now.
            return(false);
        }
Esempio n. 2
0
 public void beginConditionalRender()
 {
     GL.BeginConditionalRender(_index, ConditionalRenderType.QueryByRegionWait);
 }
Esempio n. 3
0
 /// <summary> Begin a conditional section conditioned on the result of this query
 /// Use GLOperationEndConditionalRender to finish the condition section.</summary>
 public void BeginConditional(ConditionalRenderType mode)
 {
     GL.BeginConditionalRender(Query.Id, mode);
 }
Esempio n. 4
0
 /// <summary> Called by render list and executes the operation </summary>
 public override void Execute(GLMatrixCalc c)
 {
     GL.BeginConditionalRender(id, mode);
 }