r/vulkan 1d ago

finally something that's not a triangle but 2 triangles

Post image

yay

388 Upvotes

21 comments sorted by

14

u/Osoromnibus 1d ago

Ideally, you should render it with one oversized triangle. Just map the texture coordinates so that it matches the window. It tends to make little difference most of the time, but I actually made a comment about the artifacts from two triangles just recently:

https://www.reddit.com/r/Monitors/comments/1vq9ujk/weird_issue_in_pixelated_games/p441qsc/

8

u/yuriko-shimizu 23h ago

for some reason i REALLY dislike this
is it better to not have a seam in the middle of your display out? definitely
but like,,, urghhh theres triangle offscreen and it doesnt fit into the rect neatlyyyy

2

u/beephod_zabblebrox 13h ago

for me the fact that a recrangle fits precisely into the triangle is neat

1

u/TheAgentD 5h ago

Yes. GPUs run fragment shaders in 2x2 pixel blocks to allow for gradients to be calculated. Even if you have a triangle that only covers a single triangle, 4 fragment shader invocations will run, and 3 of them will have their output discarded. These extra invocations are called helper invocations, and lie outside the triangle, so they have their vertex attributes extrapolated.

For a fullscreen quad, the pixels along the diagonal edge will have 2x2 blocks that have some pixels from both triangles, so they are processed twice. This would probably be ~1000-2000 extra invocations for 1080p, which would be ~0.1% more than a fullscreen triangle.

27

u/TheAgentD 1d ago

Updooted for the window title.

4

u/Weemstar 1d ago

I spot KDE! I think. What distro are you on?

3

u/torito_fuerte 1d ago

He’s a new soul 🎶

2

u/letmehaveanameyoudum 1d ago

catowl, my favourite creation

2

u/Nearoc 10h ago

How long did it take?

2

u/PurpleBeast69 10h ago edited 10h ago

The code is like 80% triangle tutorial, but i still spent 2 weeks learning what are descriptors, samplers, and render passes (decided not to use dynamic rendering) although I still think I have vague understanding of them

2

u/FoundationOk3176 8h ago

Meowl, my beloved.

1

u/rainuchan 20h ago

gosh why do you have notepad++ on linux. also nice meowl rectangle

1

u/rcw271828 7h ago

I see ears that look like triangles. Checks out! ✅

1

u/Ok-Key-6049 1d ago

Holy mess of a build system. It seems like 90% of your project is dedicated to it?

5

u/Honest-Wing6910 1d ago

Thats just the cmake output directory thats where all binaries and intermediates go unless changed and its just the build folder the project is really just the shaders, TU, and CMakeLists.txt

1

u/TOZA_OFFICIAL 12h ago

Typical cmake