-
Notifications
You must be signed in to change notification settings - Fork 548
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
[WebGL] Fix index buffer usage #3682
Conversation
At least the index buffer works now? 🎉 |
Yes, now we can allocate an index buffer and send data to it. But I don't know why this buffer also used for other data even if it doesn't have |
96eeebe
to
7481cb8
Compare
@kvark Texture problem seems unrelated to buffer usage. I'm trying to investigate what's wrong. Anyway index buffer fix should be ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
A few nits I commented are not too important.
One question in the end is perhaps good to resolve before merging.
src/backend/gl/src/command.rs
Outdated
@@ -115,7 +114,7 @@ pub enum Command { | |||
SetBlendSlot(ColorSlot, Option<pso::BlendState>), | |||
BindAttribute(n::AttributeDesc, n::RawBuffer, i32, u32), | |||
//UnbindAttribute(n::AttributeDesc), | |||
CopyBufferToBuffer(n::RawBuffer, n::RawBuffer, command::BufferCopy), | |||
CopyBufferToBuffer(n::RawBuffer, n::RawBuffer, u32, u32, command::BufferCopy), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note for the future: we should refactor this an other variants to have named fields. A bare number is too ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this one, and added TODO
to fix others.
@@ -233,10 +233,11 @@ impl Device { | |||
gl.use_program(Some(program)); | |||
} | |||
for (name, &(register, slot)) in name_binding_map.iter() { | |||
log::trace!("Get binding {:?} from program {:?}", name, program); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the backend currently imports the macros from log
, so it can be just trace!
here.
At the end of the day, I'd prefer all the code to use the style you used here with fully-qualified log, but it's not very important to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in separate commit. I'm also prefer log::
style.
&& dst_target == glow::ELEMENT_ARRAY_BUFFER; | ||
|
||
let copy_src_target = glow::COPY_READ_BUFFER; | ||
let copy_dst_target = if is_index_buffer_only_element_dst { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just use the dst_target
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved comment higher
// WebGL not allowed to copy data from other targets to element buffer and can't copy element data to other buffers
7481cb8
to
40f8cf5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is high quality code!
bors r+
Merge conflict. |
40f8cf5
to
816dafe
Compare
Still CI errors |
816dafe
to
e310f85
Compare
Sorry, should be fixed now! But looks like CI is stuck 🤔 |
bors r+ |
Fixes #3669
PR checklist:
make
succeeds (on *nix)make reftests
succeedsCurrently, the problem is not fully resolved: