Giter Site home page Giter Site logo

Vertex buffers about encase HOT 5 OPEN

daxpedda avatar daxpedda commented on July 28, 2024
Vertex buffers

from encase.

Comments (5)

teoxoy avatar teoxoy commented on July 28, 2024 2

I'd personally use bytemuck (for vertex buffers) for now since there is no extra padding needed for them.

from encase.

teoxoy avatar teoxoy commented on July 28, 2024

Vertex buffers are a bit tricky to fit into the current design since they have a couple more limitations but also offer more flexibility at the same time. Only scalars and vectors should be allowed and there are also 8 bit and 16 bit variants that get mapped automatically to 32 bit ones in the shader.

I experimented with adding support for them a while ago but don't have anything concrete yet.

Do note that using the existing uniform/storage buffer warpers for this might not always work since vertex buffer items are tightly packed.

from encase.

daxpedda avatar daxpedda commented on July 28, 2024

Thanks for the explanation, will do.

from encase.

kaphula avatar kaphula commented on July 28, 2024

I'd personally use bytemuck (for vertex buffers) for now since there is no extra padding needed for them.

Sorry for necrobump, but is there currently a solution for index buffers? As far as I know, if you have index buffer of u16 values for example, you need to pad them correctly. Casting arbitrarily sized index array through bytemuck can fail unlike vertex buffer.

Edit: Well I scrapped something for this case and it seems to work:

pub fn pad_index_buffer(buffer: &[u16]) -> Vec<u16> {
    let s = buffer.len() % 4;
    let mut gg = buffer.to_vec();
    if s > 0 {
        for _ in 0..s {
            gg.push(0);
        }
    }
    gg
}

from encase.

teoxoy avatar teoxoy commented on July 28, 2024

@kaphula &[u16] to &[u8] via bytemuck should work, the reverse might not (if the size is odd).

from encase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.