Fernando Sahmkow
2019-Jun-13 13:42 UTC
[Nouveau] Question on interoperability with Nouveau
Hi guys again. A homebrew developer (homebrew is custom software made for the switch using openGL under nouveau) reported to me that 'glGenerateMipmap' wasn't working on yuzu (Nintendo Switch emulator). I looked into it and I noticed all the triangle data used by nouveau to render the mipmaps was all zeroed out, meaning that probably we don't implement the mechanism you guys use to upload that data. How can I track this in your code and know what you guys use to upload the triangles data into gpu memory ? -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20190613/e5e74cf2/attachment.html>
This is done with a sequence of blits, from level 0 -> level 1, then level 1 -> level 2, etc. st/mesa has a helper which will call the gallium driver's blit method with the appropriate parameters. Internally, assuming there's nothing too funky going on, we'll use the 2d blit logic (class 0x902d). If the 3d logic is invoked, it's a simple shader that textures the source and produces the output. We do use some funky settings when invoking that shader though -- most likely thing that you might not have implemented in your emulator is that we disable VIEWPORT_TRANSFORM_EN, so the coordinates produced by the vertex shader are non-normalized. We also use enormous coordinates to draw a single triangle that will cover any possible fb size. This is the full blit function: https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c#n1573 The 2d case is handled by nvc0_blit_eng2d, while 3d is handled by nvc0_blit_3d. The 3d case sets up the rasterizer for the expectations of the vert and frag shaders, then sticks some data into a cpu-mapped VBO, and executes it. Don't worry about the actual shader contents -- they're entirely unsurprising. But if you're really interested, the fp shader is generated in nv50/nv50_surface.c. Hope this helps, -ilia On Thu, Jun 13, 2019 at 9:42 AM Fernando Sahmkow <fsahmkow27 at gmail.com> wrote:> > Hi guys again. A homebrew developer (homebrew is custom software made for the switch using openGL under nouveau) reported to me that 'glGenerateMipmap' wasn't working on yuzu (Nintendo Switch emulator). I looked into it and I noticed all the triangle data used by nouveau to render the mipmaps was all zeroed out, meaning that probably we don't implement the mechanism you guys use to upload that data. > > How can I track this in your code and know what you guys use to upload the triangles data into gpu memory ? > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau