asc-community / MxEngine

C++ open source 3D game engine
BSD 3-Clause "New" or "Revised" License
1.12k stars 59 forks source link

[Rendering] optimize SSAO & DOF algorithms by using R8-channel texture for computations (reduces bandwidth) #80

Open MomoDeve opened 1 year ago

MomoDeve commented 1 year ago

Right now RGBA16F texture is used. This is completely unnecessary and wastes bandwidth, better to have a separate R8 channel texture for such computations

fall2019 commented 1 year ago

Yeah I will do it after screen space ray tracing and hi-z finished.

MomoDeve commented 1 year ago

@fall2019 btw, I noticed you used RenderToTextureNoClear in ApplyDepthOfFieldEffect. Is it required? Because rendering without clear is slower in general than rendering with clear. If its not required, I can create a separate issue to fix that UPD: Tested local, seems like it works with clear, if its correct, I can merge that with https://github.com/asc-community/MxEngine/pull/78 (https://github.com/asc-community/MxEngine/pull/78/commits/8096700fb6ef5e1eb44f19cd3db7458e0fc48217)

fall2019 commented 1 year ago

Sure.You can just remove that without any problem. I was thinking like if I don't need to clear it why would I call this clear function. 🤣

MomoDeve commented 1 year ago

Sure.You can just remove that without any problem. I was thinking like if I don't need to clear it why would I call this clear function. 🤣

OK) But actually when you are clearing, the gpu can discard the old contents and just write color + draw call data, opposite to retrieving data from memory and then storing it. In vulkan there is a 3d option - dont_care (aka discard). It is used for the cases like drawing full screen rect, when you guarantee you don't need old content and will fully fill the render target with new data https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkAttachmentLoadOp.html