2
\$\begingroup\$

When i call gldrawarrays with a large set of data will the function return only after drawing all the vertices or will it happen asynchronously b/w cpu and gpu?

Also how does vsync work. Aren't they related?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

By calling glDrawArrays you queue that action in the GPU. It will get executed the next time you call glFlush which is also executed by the platform dependent SwapBuffers function.

VSync is a completely different thing. It synchronizes SwapBuffers with your monitors refresh rate to avoid 'tearing' artifacts. Tearing is when half of the screen was displayed with one frame and half of the screen with the next frame. This is perceived by the eye and can become ugly and annoying.

\$\endgroup\$
8
  • \$\begingroup\$ Can path tracing be implemented to render at real time?? \$\endgroup\$ Commented Nov 15, 2016 at 11:36
  • \$\begingroup\$ These are very little questions that didn't fit to be a separate thread..that's why I Am commenting \$\endgroup\$ Commented Nov 15, 2016 at 11:37
  • \$\begingroup\$ When I call glflush..Will it return only after processing the draw call queue?? \$\endgroup\$ Commented Nov 15, 2016 at 11:38
  • \$\begingroup\$ Ohhh...optimising cpu overhead is what all about Vulcan know. They ask is to write our own drivers?? \$\endgroup\$ Commented Nov 15, 2016 at 11:45
  • 1
    \$\begingroup\$ @YashwanthCB That question is too vague to answer. Look at current top engines and see whether they can achieve it. Look at specific things you want to achieve and google them. There is a lot of research regarding 3D graphics so there might be some approaches already laid out that you can attempt. \$\endgroup\$ Commented Nov 15, 2016 at 12:18
1
\$\begingroup\$

When you give any draw command. The function returns its value immediately in next tick. You give "gldrawarrays" it tells gpu to draw all stuff. Cpu goes to the next command, while gpu is still drawing. note that cpu doesn't pause for the gpu to complete the drawing process.

That's one of the reason why we use delay function at end of code. We tell cpu to wait until gpu completes drawing ( I don't know which language you you are using so i cannot tell you exactly which command delays.)

\$\endgroup\$
7
  • \$\begingroup\$ Can multiple thread summit a draw call to single context? \$\endgroup\$ Commented Nov 15, 2016 at 11:33
  • \$\begingroup\$ How do find whether the draw call has finished its job? \$\endgroup\$ Commented Nov 15, 2016 at 11:35
  • \$\begingroup\$ stackoverflow.com/questions/27942045/… \$\endgroup\$ Commented Nov 15, 2016 at 11:40
  • \$\begingroup\$ Look at retro koradi answer. He has explained it in detail \$\endgroup\$ Commented Nov 15, 2016 at 11:41
  • 1
    \$\begingroup\$ You are measuring time taken by cpu to give instructions to gpu. \$\endgroup\$ Commented Nov 15, 2016 at 11:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.