smoogipoo / smgi.me

Home sweet home
https://smgi.me
1 stars 0 forks source link

blog/post/deferred-renderer/ #9

Open utterances-bot opened 3 months ago

utterances-bot commented 3 months ago

smgi | Deferred rendering? ...what's that?

The next release of osu! will feature a set of “experimental” renderers. You should definitely try them out and report back on your experiences!

https://smgi.me/blog/post/deferred-renderer/

smoogipoo commented 3 months ago

Does this even work anymore?

miguelmartin75 commented 3 months ago

This reminds me of sokol_gl's layers; sokol_gl is utility code over sokol_gfx inspired by OpenGL 1.x's stateful drawing API. Each layer in sokol is composed of vertices, uniforms and a sequence of commands, which corresponds to your "hierarchy" flattening if I understand correctly. A command can either be "Draw", "Viewport change" or "Scissor Rect"

For each "draw command" (sgl_begin_*() / sgl_end() pair), a new command is constructed (e.g. sgl_begin_quads) and vertex data is copied via sgl_v* (docs) calls . On an sgl_end call: commands are potentially merged with a basic greedy heuristic (merge "duplicate" commands next to each other, see docs).

By default layer "0" is used. All layers are constructed/cleared every frame (memory is re-used). All layers are all contained in a flat array and are drawn by iterating & filtering with integers (layer_id) associated to each command. Layer drawing can be "deferred" / re-ordered by calling sgl_draw_layer(layer_id) (sgl_draw draws layer 0). Unfortunately you cannot re-use layers between frames, but I think this is just a trade-off that was made. As a side note, another trade-off/inefficiency I also noted from sokol_gl's API design/implementation was no ability to batch copy vertices (i.e. to result in fast memcpy's of a large amount of data)

On a sgl_draw_layer call: simple optimizations such as not re-binding to the same texture or shader are also performed.

Ross0907 commented 2 months ago

tried both vulkan(experimental) and direct3D 11 experimental.

tldr: vulkan(experimental) reduces input lag and feels snappier but has lower fps (260- ish during and 300 - ish in the lobby and menus gameplay and in my case with a amd rx 550 gpu and a amd ryzen 3200g cpu)

while direct 3D(experimental) gives similar input lag but with a huge fps boost (locked 900 - 1000 during gameplay and 400 - 500 in lobby and menus)

overall direct 3d 11(experimental) has the best performance and also eliminates the stutters i used to face while using opengl or d3d 11

Ross0907 commented 2 months ago

another thing id like to mention is that using unlimited fps options still locks the fps to 1000 and the frame time to 1ms i would love for that to be unlocked

DecBr commented 2 months ago

how do i leave bug reports? i guess i'll leave this here for the time being.. vulkan rendering "failing to initialise" even though i run almost all of my games with vulkan with no issues, here's a video :) https://youtu.be/-QPy7UuVUGc

smoogipoo commented 2 months ago

Leave feedback / bug reports here: https://github.com/ppy/osu/discussions/27659