This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is it possible to short-circuit a submitted draw based on time

This is an interesting question: Is it possible to query a timestamp and in doing so, determine if vertex/fragment shaders should return prematurely, thus rushing to the end of the drawcall if a particular time has elapsed? Put another way, can we use a timestamp to somehow short-circuit a submitted draw call? For example, could we issue millions of instances in a call and 'end' the call (read a timestamp in shader) when we got to, say, 14ms, thus keeping the rendering time to 60fps?

Would the workload have to be split into batches and the "time query" have to be done prior to issuing each call?

Sean

Parents
  • Sean, it's not quite exactly what you've asked for, but you may be interested in the "EGL_IMG_context_priority" extension to EGL.  With that extension you can declare the priority of a GLES context to HIGH, MEDIUM, or LOW.

    I do understand you've asked for the ability to *cancel* a draw call if too much time has passed, but is the underlying question is how to interrupt an existing draw call to get some other GL work done?  If so, you could make your existing (potentially long) draws with a MEDIUM or LOW priority context, and then issue your other GL work in a HIGH priority context and the driver may interrupt the LOW priority context to complete the HIGH priority calls.

    (One use for this extension is to have a long-running render in a low-priority thread/context (like 100ms), and a short render (like 8ms) in another high-priority thread that uses the output of the long-running render as a source texture.  That way you can always update the screen with motion or HUD contents at a high-frame rate, even if (say) a scene render takes a long time.)

    What are your target platforms?

    (Sorry I don't have a direct answer about how to cause a shader to terminate early based on time.)

Reply
  • Sean, it's not quite exactly what you've asked for, but you may be interested in the "EGL_IMG_context_priority" extension to EGL.  With that extension you can declare the priority of a GLES context to HIGH, MEDIUM, or LOW.

    I do understand you've asked for the ability to *cancel* a draw call if too much time has passed, but is the underlying question is how to interrupt an existing draw call to get some other GL work done?  If so, you could make your existing (potentially long) draws with a MEDIUM or LOW priority context, and then issue your other GL work in a HIGH priority context and the driver may interrupt the LOW priority context to complete the HIGH priority calls.

    (One use for this extension is to have a long-running render in a low-priority thread/context (like 100ms), and a short render (like 8ms) in another high-priority thread that uses the output of the long-running render as a source texture.  That way you can always update the screen with motion or HUD contents at a high-frame rate, even if (say) a scene render takes a long time.)

    What are your target platforms?

    (Sorry I don't have a direct answer about how to cause a shader to terminate early based on time.)

Children
  • Thanks bradgrantham!

    Your answer is very welcome, tremendously useful, and very enlightening. I was unaware of the IMG_context_priority extension (which I assume Mali supports) which seems tremendously useful -- Thank you!. You are correct that this isn't exactly what I had in mind, but if the implementation is reliable, it can stand in and produce the same results as a full-cancel under many circumstances, and with a potentially more straight-forward implementation. I am very grateful for the suggestion, and will be thinking as to weather this will suit my needs -- I suspect it might!

    I haven't started my graphics project just yet but will be targeting Samsung's Gear VR hardware which implies Mali and potentially Adreno. I'm really excited to get started!

    Sean