Vector path rendering for Vulkan#1264
Conversation
… the same time due to use after free bug
|
Super cool stuff! Dean will be taking a look at this! Perhaps this also frees me up on the OpenGL side to look at supporting vector graphics without having to worry about the Vulkan side needing additional work to match. |
|
Very exciting seeing someone else use this for the first time! The Vulkan code on the whole is spot on except for 2 issues with the buffer use. The first issue is here: The second issue is that you CAN'T destroy the vertex/index buffers at the end of the frame. This is completely invalid because the commands using the buffers haven't been executed yet. They're not submitted until the end of the frame, and the execution itself will take much longer because all the 3d shit is executed first! The only reason it's working at all is that the implementation is taking the liberty to defer the actual data destruction. This should also be triggering a validation error (though not with certainty), so make sure you've installed the Vulkan SDK. Fortunately, you don't need to worry about buffer disposal either. The Staged buffers you're using take more time to create so are only intended for long-term data like the text-quad. Creating new vertex data on the fly works the same way as uniforms. Just do this (I just tweaked it so be sure to pull): Other than that, she's ready to merge as far as the Vulkan goes, great work! |
|
The reviewed changes have been implemented. |
|
Updated. |
|
Good work once again. Just three minor changes needed:
|
|
@deanjl I implemented the suggested changes. |
|
The vert shader still doesn't conform to the right pattern. Just paste this in: Vulkan uniforms suck. |
|
Update: multiple color attachments for rendering to has now been enabled so |
|
@deanjl Done! |
|
Currently going through a period of exhaustion, so I don't know when I'll get to this. I'll try to get to it tomorrow or Sunday. Sorry for being the one holding this up. I just need some rest. |
| descriptor.Stroke.StrokeColor descriptor.Stroke.StrokeThickness descriptor.Stroke.StrokeFringeWidth | ||
|
|
||
| // only render if we have geometry | ||
| if vertices.Length > 0 && indices.Length > 0 then |
There was a problem hiding this comment.
In this scope, you've interrupted the sprite batch, yet you might not be rendering anything. That would be a waste to interrupt the sprite batch if nothing is rendered.
| @@ -0,0 +1,382 @@ | |||
| // Nu Game Engine. | |||
There was a problem hiding this comment.
Use the new notice plz -
// Nu Game Engine.
// Required Notice:
// Copyright (C) Bryan Edds.
// Nu Game Engine is licensed under the Nu Game Engine Noncommercial License.
// See https://github.com/bryanedds/Nu/blob/master/License.md.
| open System.Numerics | ||
| /// Describes a vector path command. | ||
| type [<Struct>] VectorPathCommand = | ||
| | MoveTo of endPoint: Vector2 |
There was a problem hiding this comment.
I think the standard formatting is | MoveTo of EndPoint : Vector2, but check Standard.md to make sure.
There was a problem hiding this comment.
Oh, I treated it as a parameter but it should be treated as a Field instead.
| | Positive | ||
| | Negative | ||
| | AbsGeqTwo | ||
| with static member Default = EvenOdd // default from LibTessDotNet |
There was a problem hiding this comment.
The with is superfluous and not what our Standard.md prescribes.
| member this.StrokeThickness = lens (nameof Entity.StrokeThickness) this this.GetStrokeThickness this.SetStrokeThickness | ||
|
|
||
| /// Gives an entity the base behavior of a circle render. | ||
| type CircleDispatcher () = |
There was a problem hiding this comment.
Once this PR is merged, I'm going to do some surgery on all of these dispatchers. Nothing actionable for this PR here, tho.
|
All the raised issues should now be resolved. |
Added vector path rendering.
Also added -
with adjustable stroke and fill parameters.
Assets not propagated yet, awaiting review.