-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batching draw calls #86
Comments
@david-vanderson Is scissor/clipping necessary? I want to make the last argument of |
Thanks for the backend improvements! I'm still trying to wrap my head around whether dvui can interleave drawing with calling the backend directly. The main sticking point is floating subwindows. The dvui draw calls for those happen in the middle of the main window, and are deferred so they draw on top of the main window (and lower subwindows). I think any direct backend drawing would have to be deferred somehow as well (except if it's in the main window). For clipping, I think that any widget could be in a scroll area where some/all of it is clipped, so the widget doing the drawClippedTriangles() call can't know whether it needs to be clipped or not. Does that answer your question? In the code you had a comment about checking the clipping rect before creating the triangles, and I think that is a good idea. What does the comment "TK" mean? |
I'm not sure what you mean. Please see the
Yes. I'll see if I can make the type
"To come" in literature writing. It means "todo" but for text content because "TK" sticks out visually. Please write those. I have little idea how to describe those functions properly. |
Okay, it looks like we both hit on the same idea of deferring drawing. This is already done at the one-step-above-triangles level - see I'll comment the other functions. Now I know about TK! |
what to give to the library user: RenderCmd: text layout is hard to get right. I think the |
Ah okay I think I'm getting it. Yes - if we are passing stuff to the user, then triangles are the way to go. I think we are talking about different things. See the new direct SDL drawing that I added to sdl-standalone. I'm trying to give the ability to go around dvui for rendering, at least for the main window. I couldn't think of an easy way to make it work for floating subwindows, so I'm punting on that until someone asks. |
Well uh... you ask the library user to draw on a texture, then render the texture. The dvui can handle recreating or reuse textures when the bounding box changes. |
Yes - the 3 potential ways I know of so far to do subwindow custom drawing are:
Each of them requires some additional cooperation between dvui and the user code. I'm not going to think too hard about this until somebody shows up with a real usecase for it. |
During my work with draw calls (#83 (comment)), I created the following new API design
Currently:
vtx
andidx
backend.drawClippedTriangles
with temporary memoryI propose the following new API:
backend.allocDrawCall(vtx_len, idx_len)
to allocate memoryvtx
andidx
backend.drawClippedTriangles
with temporary memorybenefit: zero copy.
backend.allocDrawCall
decides the lifetime of memory returned.if no batching, lifetime = until
drawClippedTriangles
is calledif batching, lifetime = until end of frame
The text was updated successfully, but these errors were encountered: