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

Implement WebGLRenderingContextBase.getAttachedShaders #20411

Merged
merged 3 commits into from Mar 24, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Implement WebGLRenderingContextBase.getAttachedShaders

  • Loading branch information
nox committed Mar 24, 2018
commit a62bed82e40220d0272b31fff542c30ea70e9ff7
@@ -974,6 +974,14 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
level: i32) {
self.base.FramebufferTexture2D(target, attachment, textarget, texture, level)
}

/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetAttachedShaders(
&self,
program: &WebGLProgram,
) -> Option<Vec<DomRoot<WebGLShader>>> {
self.base.GetAttachedShaders(program)
}
}


@@ -367,6 +367,19 @@ impl WebGLProgram {
self.renderer.send(WebGLCommand::GetProgramParameter(self.id, param_id, sender)).unwrap();
receiver.recv().unwrap()
}

pub fn attached_shaders(&self) -> WebGLResult<Vec<DomRoot<WebGLShader>>> {
if self.is_deleted.get() {
return Err(WebGLError::InvalidValue);
}
Ok(match (self.vertex_shader.get(), self.fragment_shader.get()) {
(Some(vertex_shader), Some(fragment_shader)) => {
vec![vertex_shader, fragment_shader]
}
(Some(shader), None) | (None, Some(shader)) => vec![shader],
(None, None) => vec![]
})
}
}

impl Drop for WebGLProgram {
@@ -3598,6 +3598,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
None => self.webgl_error(InvalidOperation),
};
}

/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetAttachedShaders(
&self,
program: &WebGLProgram,
) -> Option<Vec<DomRoot<WebGLShader>>> {
handle_potential_webgl_error!(self, program.attached_shaders().map(Some), None)
}
}

pub trait LayoutCanvasWebGLRenderingContextHelpers {
@@ -563,7 +563,7 @@ interface WebGLRenderingContextBase

WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index);
WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index);
//sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
sequence<WebGLShader>? getAttachedShaders(WebGLProgram program);

[WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name);

@@ -1,14 +1,10 @@
[methods.html]
type: testharness
[WebGL test #0: Property either does not exist or is not a function: getAttachedShaders]
[WebGL test #0: Property either does not exist or is not a function: getRenderbufferParameter]
expected: FAIL

[WebGL test #1: Property either does not exist or is not a function: getRenderbufferParameter]
[WebGL test #1: Property either does not exist or is not a function: getUniform]
expected: FAIL

[WebGL test #2: Property either does not exist or is not a function: getUniform]
expected: FAIL

[WebGL test #3: Property either does not exist or is not a function: isContextLost]
[WebGL test #2: Property either does not exist or is not a function: isContextLost]
expected: FAIL

This file was deleted.

This file was deleted.

@@ -1,9 +1,2 @@
[program-test.html]
type: testharness
expected: ERROR
[WebGL test #17: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

[WebGL test #21: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

expected: CRASH
@@ -1,9 +1,29 @@
[gl-object-get-calls.html]
type: testharness
expected: ERROR
[WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
[WebGL test #33: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_WIDTH) should be 2. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[Untitled]
[WebGL test #34: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_HEIGHT) should be 2. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #35: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_INTERNAL_FORMAT) should be non-zero. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #36: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_DEPTH_SIZE) should be non-zero. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #39: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_RED_SIZE) should be non-zero. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #40: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_GREEN_SIZE) should be non-zero. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #41: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_BLUE_SIZE) should be non-zero. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #42: gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_ALPHA_SIZE) should be non-zero. Threw exception TypeError: gl.getRenderbufferParameter is not a function]
expected: FAIL

[WebGL test #43: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.