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
Kick off WebGL 2.0 implementation #19028
Conversation
Heads up! This PR modifies the following files:
|
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.
Huh, it was way simpler to review than what I expected!
r=me, with the nits
|
||
#[allow(unsafe_code)] | ||
fn get_gl_attributes(cx: *mut JSContext, attrs: Option<HandleValue>) -> Option<GLContextAttributes> { | ||
if let Some(webgl_attributes) = attrs { |
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: This can read nicer like:
let webgl_attributes = match attrs {
Some(attrs) => attrs,
None => return Some(GlContextAttributes::default()),
};
// ...
} | ||
|
||
impl WebGL2RenderingContext { | ||
fn new_inherited(window: &Window, |
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: For new code, I think it's preferable to use block indentation for arguments and such, like:
fn new_inherited(
window: &Window,
canvas: &HTMLCanvasElement,
size: Size2D<i32>,
attrs: GLContextAttributes,
) -> Option<Self> {
This applies to other parts of the patch, feel free to reformat the signatures you're touching too if you want.
} | ||
|
||
impl WebGL2RenderingContextMethods for WebGL2RenderingContext { | ||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1 |
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: I'd use doc comments (///
instead of //
), but no big deal.
#[allow(unsafe_code)] | ||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 | ||
unsafe fn BufferData(&self, cx: *mut JSContext, target: u32, data: *mut JSObject, usage: u32) -> Fallible<()> { | ||
self.base.BufferData(cx, target, data, usage) |
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.
Ugh, it'd be nice to forward all these a bit more easily :(.
Can you file an issue to maybe generate macros from CodegenBinding.py
or something like that? Not sure if it's common enough to be worth it, but...
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.
I didn't find this pattern in another API. WebGL 2.0 WebIDL implements both interfaces instead of using inheritance.
At least I generated all this stuff with a local script ;) I'll open that issue to see if it's worth for more APIs
@bors-servo delegate+ |
✌️ @MortimerGoro can now approve this pull request |
@bors-servo r=emilio |
📌 Commit 379a6a0 has been approved by |
Kick off WebGL 2.0 implementation <!-- Please describe your changes on the following line: --> This PR kicks off the WebGL 2.0 implementation: - Include WebGL2RenderingContext.webidl and comment unimplemented methods - Create WebGL2 struct hierarchy with WebGL 1.0 backwards compatibility - Add WebGL 2.0 entry points to canvas - Select the correct GL Version on GLContext backends (related PR servo/surfman#108) - Add WebGL version selection in shader compilations - Create a WebGL 2.0 preference I tried a complex three.js demo using canvas.getContext("webgl2") and the backwards compatibility worked great. Next steps: - I'll add WebGLVersion selection/filtering to WebGLExtensions and move some extensions to core in WebGL 2.0 (e.g. VAOs) - I'll add the WebGL 2.0 conformance WPT - I'll create a mega-issue with a the list of all TODO methods for a complete WebGL 2.0 implementation (as @emilio did with WebGL 1.0), so we can start start getting community involvement. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because I will add the entire webgl 2.0 WPT in a different PR <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19028) <!-- Reviewable:end -->
💔 Test failed - mac-rel-wpt3 |
Test failures fixed: It was just due to a invalid CanvasContext::WebGL2 enum set in HTMLCanvasElementContext when creating a WebGL1 context. @bors-servo r=emilio |
📌 Commit ddd6c86 has been approved by |
Kick off WebGL 2.0 implementation <!-- Please describe your changes on the following line: --> This PR kicks off the WebGL 2.0 implementation: - Include WebGL2RenderingContext.webidl and comment unimplemented methods - Create WebGL2 struct hierarchy with WebGL 1.0 backwards compatibility - Add WebGL 2.0 entry points to canvas - Select the correct GL Version on GLContext backends (related PR servo/surfman#108) - Add WebGL version selection in shader compilations - Create a WebGL 2.0 preference I tried a complex three.js demo using canvas.getContext("webgl2") and the backwards compatibility worked great. Next steps: - I'll add WebGLVersion selection/filtering to WebGLExtensions and move some extensions to core in WebGL 2.0 (e.g. VAOs) - I'll add the WebGL 2.0 conformance WPT - I'll create a mega-issue with a the list of all TODO methods for a complete WebGL 2.0 implementation (as @emilio did with WebGL 1.0), so we can start start getting community involvement. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because I will add the entire webgl 2.0 WPT in a different PR <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19028) <!-- Reviewable:end -->
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit ddd6c86 has been approved by |
Kick off WebGL 2.0 implementation <!-- Please describe your changes on the following line: --> This PR kicks off the WebGL 2.0 implementation: - Include WebGL2RenderingContext.webidl and comment unimplemented methods - Create WebGL2 struct hierarchy with WebGL 1.0 backwards compatibility - Add WebGL 2.0 entry points to canvas - Select the correct GL Version on GLContext backends (related PR servo/surfman#108) - Add WebGL version selection in shader compilations - Create a WebGL 2.0 preference I tried a complex three.js demo using canvas.getContext("webgl2") and the backwards compatibility worked great. Next steps: - I'll add WebGLVersion selection/filtering to WebGLExtensions and move some extensions to core in WebGL 2.0 (e.g. VAOs) - I'll add the WebGL 2.0 conformance WPT - I'll create a mega-issue with a the list of all TODO methods for a complete WebGL 2.0 implementation (as @emilio did with WebGL 1.0), so we can start start getting community involvement. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because I will add the entire webgl 2.0 WPT in a different PR <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19028) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This PR kicks off the WebGL 2.0 implementation:
I tried a complex three.js demo using canvas.getContext("webgl2") and the backwards compatibility worked great.
Next steps:
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is