mirror of
https://github.com/servo/servo.git
synced 2025-07-30 10:40:27 +01:00
Auto merge of #20631 - brainlessdeveloper:add-webgl-get-renderbuffer-parameter, r=emilio
Implement WebGL GetRenderbufferParameter This needed a bump of gleam to version 0.4.33 for this https://github.com/servo/gleam/pull/162 <!-- Please describe your changes on the following line: --> I think my changes in test expectations are pretty naive and I have to wait for the PR to run on CI to see what the actual impact is. I'd like some guidance on this, too. --- <!-- 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 build-geckolib` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20514 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/20631) <!-- Reviewable:end -->
This commit is contained in:
commit
f1a06e0d0c
8 changed files with 191 additions and 110 deletions
|
@ -159,6 +159,17 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
self.base.GetFramebufferAttachmentParameter(cx, target, attachment, pname)
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
|
||||
unsafe fn GetRenderbufferParameter(
|
||||
&self,
|
||||
cx: *mut JSContext,
|
||||
target: u32,
|
||||
pname: u32
|
||||
) -> JSVal {
|
||||
self.base.GetRenderbufferParameter(cx, target, pname)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||
fn ActiveTexture(&self, texture: u32) {
|
||||
self.base.ActiveTexture(texture)
|
||||
|
|
|
@ -2348,6 +2348,45 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
Int32Value(receiver.recv().unwrap())
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
|
||||
unsafe fn GetRenderbufferParameter(
|
||||
&self,
|
||||
_cx: *mut JSContext,
|
||||
target: u32,
|
||||
pname: u32
|
||||
) -> JSVal {
|
||||
let target_matches = target == constants::RENDERBUFFER;
|
||||
|
||||
let pname_matches = match pname {
|
||||
constants::RENDERBUFFER_WIDTH |
|
||||
constants::RENDERBUFFER_HEIGHT |
|
||||
constants::RENDERBUFFER_INTERNAL_FORMAT |
|
||||
constants::RENDERBUFFER_RED_SIZE |
|
||||
constants::RENDERBUFFER_GREEN_SIZE |
|
||||
constants::RENDERBUFFER_BLUE_SIZE |
|
||||
constants::RENDERBUFFER_ALPHA_SIZE |
|
||||
constants::RENDERBUFFER_DEPTH_SIZE |
|
||||
constants::RENDERBUFFER_STENCIL_SIZE => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
if !target_matches || !pname_matches {
|
||||
self.webgl_error(InvalidEnum);
|
||||
return NullValue();
|
||||
}
|
||||
|
||||
if self.bound_renderbuffer.get().is_none() {
|
||||
self.webgl_error(InvalidOperation);
|
||||
return NullValue();
|
||||
}
|
||||
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
self.send_command(WebGLCommand::GetRenderbufferParameter(target, pname, sender));
|
||||
|
||||
Int32Value(receiver.recv().unwrap())
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||
fn GetProgramInfoLog(&self, program: &WebGLProgram) -> Option<DOMString> {
|
||||
match program.get_info_log() {
|
||||
|
|
|
@ -571,8 +571,7 @@ interface WebGLRenderingContextBase
|
|||
GLenum pname);
|
||||
any getProgramParameter(WebGLProgram program, GLenum pname);
|
||||
DOMString? getProgramInfoLog(WebGLProgram program);
|
||||
// FIXME: https://github.com/servo/servo/issues/20514
|
||||
// any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
any getShaderParameter(WebGLShader shader, GLenum pname);
|
||||
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
|
||||
DOMString? getShaderInfoLog(WebGLShader shader);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue