devkitPro / deko3d

Homebrew low level graphics API for Nintendo Switch (Nvidia Tegra X1)
zlib License
323 stars 23 forks source link

dkImageLayoutInitialize: Implement rendering to 3D slices #7

Closed ReinUsesLisp closed 3 years ago

ReinUsesLisp commented 4 years ago

Implement rendering to 3D image slices. The GPU supports rendering to 2D slices of 3D images as if it were a 2D array. This also includes rendering to different layers through gl_Layer.

Rendering mipmaps and to different layers through gl_Layer has been tested. gl_Layer's access is robust, applications are not able to write out of bounds and the layer is clamped to the highest valid slice.

The code for calculating the iova offset has been adapted from Ryujinx: https://github.com/Ryujinx/Ryujinx/blob/master/Ryujinx.Graphics.Texture/SizeCalculator.cs#L73-L90