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

update_buffer_vec/Deref? sets buffer length to 0 #574

Closed
bvssvni opened this issue Feb 18, 2015 · 8 comments
Closed

update_buffer_vec/Deref? sets buffer length to 0 #574

bvssvni opened this issue Feb 18, 2015 · 8 comments

Comments

@bvssvni
Copy link
Contributor

bvssvni commented Feb 18, 2015

I suspect something strange happening on Deref, but unable to pin point it.

See PistonDevelopers/gfx_graphics#135 (comment)

Overriding Gfx locally, and it prints the same size at the end of update_buffer_vec, but 0 after the function call.

TEST 1 buffer_pos: 8192, vertices: 12
TEST 1 buf.get_info().size 8192
TEST 2 buf.get_info().size 8192 <--- end of update_buffer_vec
TEST 2 buffer_pos: 0, vertices: 12 <--- after calling update_buffer_vec
TEST 1 buffer_pos: 0, vertices: 12
@bvssvni bvssvni changed the title update_buffer_vec sets buffer length to 0 update_buffer_vec/Deref? sets buffer length to 0 Feb 18, 2015
@bvssvni
Copy link
Contributor Author

bvssvni commented Feb 18, 2015

Here is a snippet of the code:

println!("TEST 1 buffer_pos: {:?}, vertices: {:?}",
buffer_pos.get_info().size, vertices.len());

renderer.update_buffer_vec(*buffer_pos, vertices, 0);
println!("TEST 2 buffer_pos: {:?}, vertices: {:?}",
buffer_pos.get_info().size, vertices.len());

Notice *buffer_pos which might call a Deref.

@kvark
Copy link
Member

kvark commented Feb 19, 2015

@bvssvni thanks for the report!
I greatly appreciate the fact you did some investigation on it already.

@ghost
Copy link

ghost commented Feb 19, 2015

I think this is a compiler bug. I can produce a very similar bug in snowmew. Using .clone() every time you would copy the handle is a work around for this issue. If the buffer handle is copied it gets zeroed out.

@bvssvni
Copy link
Contributor Author

bvssvni commented Feb 19, 2015

I opened rust-lang/rust#22536

@bvssvni
Copy link
Contributor Author

bvssvni commented Feb 19, 2015

@csherratt Any idea of how to reduce it to a test case?

@kvark
Copy link
Member

kvark commented Feb 19, 2015

Great, thanks @bvssvni !
I'm fairly certain Hematite doesn't work because of this rustc issue as well.

@kvark
Copy link
Member

kvark commented Feb 19, 2015

@bvssvni I got the test case covered ;)

@kvark
Copy link
Member

kvark commented Apr 10, 2015

Fixed in latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants