Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a second vertex buffer for instances #116

Closed
expenses opened this issue Oct 30, 2020 · 2 comments
Closed

Use a second vertex buffer for instances #116

expenses opened this issue Oct 30, 2020 · 2 comments

Comments

@expenses
Copy link

Assuming you have a second VertexBufferDescriptor set with InputStepMode::Instance, you can simply set an instance buffer like so:

render_pass.set_vertex_buffer(1, &self.instance_buffer.slice(..));

This is a lot easier than adding it to the bind group like you're doing in the instancing tutorial.

@sotrh
Copy link
Owner

sotrh commented Oct 30, 2020

You are correct. I originally showcased multiple methods of instancing, including using a texture. I used storage buffers as the default method, as I was interested in them at the time.

I'm thinking of switching to using vertex buffers for instancing, but I'm currently busy getting wgpu to work with wasm-pack. You're welcome to make a pull request.

@sotrh sotrh mentioned this issue Nov 10, 2020
7 tasks
sotrh added a commit that referenced this issue Nov 18, 2020
@sotrh
Copy link
Owner

sotrh commented Nov 24, 2020

Fixed in #126

@sotrh sotrh closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants