Skip to content

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone

The urge to write a gallium-like layer for Vulkan intensifies...

Uncategorized
6 2 0
  • The urge to write a gallium-like layer for Vulkan intensifies...

  • The urge to write a gallium-like layer for Vulkan intensifies...

    A bit more on this...

    One of the problems I keep running into when trying to do common Vulkan stuff in Mesa is that all the common code is optional. About the only thing that isn't optional is the dispatch layer that handles Get*ProcAddress(). This means that, while I can implement something in the common layer, if a driver isn't using that component for some reason, they don't get the benefit.

    The second issue is a layering problem. While the dispatch tables allow common code to call back into the driver, the common code is first and foremost a client of the driver, not the other way around. This means that I can't just add a bit of code and then start flipping on features like you can in gallium. Even if I do add it to common code, all the feature bits and all the format bits are all handled by the drivers.

    Also, there's no truly common compiler code so if something requires both API side stuff and compiler stuff, there's no way to do the compiler stuff in common and mandate it. And even if we did, since all the API-side stuff is optional, there's a chance a driver will get the compiler half but not the API half.

  • A bit more on this...

    One of the problems I keep running into when trying to do common Vulkan stuff in Mesa is that all the common code is optional. About the only thing that isn't optional is the dispatch layer that handles Get*ProcAddress(). This means that, while I can implement something in the common layer, if a driver isn't using that component for some reason, they don't get the benefit.

    The second issue is a layering problem. While the dispatch tables allow common code to call back into the driver, the common code is first and foremost a client of the driver, not the other way around. This means that I can't just add a bit of code and then start flipping on features like you can in gallium. Even if I do add it to common code, all the feature bits and all the format bits are all handled by the drivers.

    Also, there's no truly common compiler code so if something requires both API side stuff and compiler stuff, there's no way to do the compiler stuff in common and mandate it. And even if we did, since all the API-side stuff is optional, there's a chance a driver will get the compiler half but not the API half.

    This came up this last week as I was hooking up 64-bit vertex attributes for NVK and looking at how it's handled in RADV today.

    This is a feature that should be trivial to implement entirely in common code. On the compiler side, you bitcast double to uvec2 and dvec2 to uvec4. For dvec3 and dvec4, you split them into a uvec4 and a uvec2 or another uvec4, respectively. NIR already has all the code to do this.

    Then, on the API side, we could just translate between the Vulkan descriptions of vertex attributes to one that's similarly split. So we'd replace VK_FORMAT_R64_UINT with VK_FORMAT_R32G32_UINT, etc. In the 384 and 512-bit cases, we'd provide two vertex attributes, with the correct respective formats and the top half offset by 16B. This is easy to do in Vulkan because dvec3/4 attributes are already required to consume 2 locations so we don't even have to renumber them.

  • This came up this last week as I was hooking up 64-bit vertex attributes for NVK and looking at how it's handled in RADV today.

    This is a feature that should be trivial to implement entirely in common code. On the compiler side, you bitcast double to uvec2 and dvec2 to uvec4. For dvec3 and dvec4, you split them into a uvec4 and a uvec2 or another uvec4, respectively. NIR already has all the code to do this.

    Then, on the API side, we could just translate between the Vulkan descriptions of vertex attributes to one that's similarly split. So we'd replace VK_FORMAT_R64_UINT with VK_FORMAT_R32G32_UINT, etc. In the 384 and 512-bit cases, we'd provide two vertex attributes, with the correct respective formats and the top half offset by 16B. This is easy to do in Vulkan because dvec3/4 attributes are already required to consume 2 locations so we don't even have to renumber them.

    And I could do this. I could do it today. It'd take me an hour or so to type up. The problem is that not everyone uses the common state tracking code and so I can't actually ensure they get the translation. I can provide it but I'd have to hide it behind an enable bit, which only gets set by drivers that use all the necessary common pieces and want the features.

  • And I could do this. I could do it today. It'd take me an hour or so to type up. The problem is that not everyone uses the common state tracking code and so I can't actually ensure they get the translation. I can provide it but I'd have to hide it behind an enable bit, which only gets set by drivers that use all the necessary common pieces and want the features.

    But it's not really ideal.

    In an ideal world, I'd be able to tweak the compiler bits, add the API translation, and then flip the feature on across the entire Mesa stack. Boom! 64-bit vertex attributes for everyone!

  • But it's not really ideal.

    In an ideal world, I'd be able to tweak the compiler bits, add the API translation, and then flip the feature on across the entire Mesa stack. Boom! 64-bit vertex attributes for everyone!

    @gfxstrand the good thing about gallium: you can do common code changes and boom it works

    the bad thing about gallium: you have to do common code changes and boom it breaks every driver.

  • oblomov@sociale.networkundefined oblomov@sociale.network shared this topic on

Gli ultimi otto messaggi ricevuti dalla Federazione
Post suggeriti
  • Non è un film americano.

    Uncategorized
    1
    0 Votes
    1 Posts
    0 Views
    Non è un film americano. E' Rogoredo. Svolta nelle indagini sul pusher ucciso - Articolo21https://www.articolo21.org/2026/02/non-e-un-film-americano-e-rogoredo-svolta-nelle-indagini-sul-pusher-ucciso/> Il poliziotto che ha sparato a Rogoredo conosceva il pusher che ha colpito a morte. Un elemento che, insieme ad altri emersi nell’indagine della Procura di Milano, cambia completamente la narrazione offerta nelle prime ore seguite al delitto in quella che è considerata la più grande piazza di spaccio in Italia. E’ successo il 26 […]
  • 0 Votes
    1 Posts
    0 Views
    Con tutto il rispetto, non ho trovato convincente il servizio di #PresaDiretta sulla "guerra ibrida"
  • Spring 🎉

    Uncategorized
    7
    0 Votes
    7 Posts
    1 Views
    @karlpoe @dominykas where is this and why am I not there!!!
  • 0 Votes
    31 Posts
    115 Views
    @casarayuela Caro Luigi, poc'anzi ho risposto ad un nuovo gruppo che vuole fare politica di sinistra vera...Ho detto loro che sono in tanti e che sarebbe utile che si unissero anziché generare ulteriore frammentazione, che sostenessero le mobilitazioni in ogni dove, che dessero spazio alle donne viste le esperienze disumane e criminali di uomini di destra, di donne che li scimmiottano e di pseudo sinistri facili al compromesso. Perché hai ragione tu, e saremo condannati ad