Skip to content

[WIP] Use associated types for device resources #562

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

Closed
wants to merge 2 commits into from

Conversation

brendanzab
Copy link
Contributor

Gets us closer to #416.

An alternative to #517

For now I am hard coding the GlDevice as the buffer handle device parameters. Currently getting a lifetime error though:

src/device/lib.rs:203:9: 203:17 error: the associated type `<D as Device>::Buffer` may not live long enough [E0311]
src/device/lib.rs:203         self.raw.get_info()
                              ^~~~~~~~
src/device/lib.rs:203:9: 203:17 help: consider adding an explicit lifetime bound for `<D as Device>::Buffer`
src/device/lib.rs:203         self.raw.get_info()
                              ^~~~~~~~
src/device/lib.rs:202:43: 204:6 note: the associated type `<D as Device>::Buffer` must be valid for the anonymous lifetime #1 defined on the block at 202:42...
src/device/lib.rs:202     pub fn get_info(&self) -> &BufferInfo {
src/device/lib.rs:203         self.raw.get_info()
src/device/lib.rs:204     }
src/device/lib.rs:203:9: 203:17 note: ...so that the reference type `&Handle<<D as Device>::Buffer, BufferInfo>` does not outlive the data it points at
src/device/lib.rs:203         self.raw.get_info()
                              ^~~~~~~~
src/device/lib.rs:203:9: 203:17 error: the associated type `<D as Device>::Buffer` may not live long enough [E0311]
src/device/lib.rs:203         self.raw.get_info()
                              ^~~~~~~~
src/device/lib.rs:203:9: 203:17 help: consider adding an explicit lifetime bound for `<D as Device>::Buffer`
src/device/lib.rs:203         self.raw.get_info()
                              ^~~~~~~~
src/device/lib.rs:202:43: 204:6 note: the associated type `<D as Device>::Buffer` must be valid for the anonymous lifetime #1 defined on the block at 202:42...
src/device/lib.rs:202     pub fn get_info(&self) -> &BufferInfo {
src/device/lib.rs:203         self.raw.get_info()
src/device/lib.rs:204     }
src/device/lib.rs:203:9: 203:17 note: ...so that the reference type `&Handle<<D as Device>::Buffer, BufferInfo>` does not outlive the data it points at
src/device/lib.rs:203         self.raw.get_info()
                              ^~~~~~~~
error: aborting due to 2 previous errors
Could not compile `gfx_device_gl`.

@kvark
Copy link
Member

kvark commented Feb 18, 2015

Closing in favor of #564

@kvark kvark closed this Feb 18, 2015
@brendanzab brendanzab deleted the associated-types branch February 19, 2015 06:48
adamnemecek pushed a commit to adamnemecek/gfx that referenced this pull request Apr 1, 2021
562: Increase default maximum vertex buffer inputs from 8 to 16 r=kvark a=aloucks

Additionally, the input states are now stored in a `SmallVec` to enable higher limits.

Fixes gfx-rs#558

Co-authored-by: Aaron Loucks <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants