Implement WebGLRenderingContextBase.getAttachedShaders

This commit is contained in:
Anthony Ramine 2018-03-24 13:06:00 +01:00
parent 2befe47384
commit a62bed82e4
11 changed files with 149 additions and 124 deletions

View file

@ -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)
}
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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);

View file

@ -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

View file

@ -1,5 +0,0 @@
[quickCheckAPI-A.html]
type: testharness
[WebGL test #0: testValidArgs]
expected: FAIL

View file

@ -1,5 +0,0 @@
[quickCheckAPI-D_G.html]
type: testharness
[WebGL test #0: testValidArgs]
expected: FAIL

View file

@ -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

View file

@ -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

View file

@ -1,277 +1,274 @@
[methods-2.html]
[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]
[WebGL test #2: Property either does not exist or is not a function: isContextLost]
expected: FAIL
[WebGL test #3: Property either does not exist or is not a function: isContextLost]
[WebGL test #3: Property either does not exist or is not a function: getBufferSubData]
expected: FAIL
[WebGL test #4: Property either does not exist or is not a function: getBufferSubData]
[WebGL test #4: Property either does not exist or is not a function: copyBufferSubData]
expected: FAIL
[WebGL test #5: Property either does not exist or is not a function: copyBufferSubData]
[WebGL test #5: Property either does not exist or is not a function: blitFramebuffer]
expected: FAIL
[WebGL test #6: Property either does not exist or is not a function: blitFramebuffer]
[WebGL test #6: Property either does not exist or is not a function: framebufferTextureLayer]
expected: FAIL
[WebGL test #7: Property either does not exist or is not a function: framebufferTextureLayer]
[WebGL test #7: Property either does not exist or is not a function: getInternalformatParameter]
expected: FAIL
[WebGL test #8: Property either does not exist or is not a function: getInternalformatParameter]
[WebGL test #8: Property either does not exist or is not a function: invalidateFramebuffer]
expected: FAIL
[WebGL test #9: Property either does not exist or is not a function: invalidateFramebuffer]
[WebGL test #9: Property either does not exist or is not a function: invalidateSubFramebuffer]
expected: FAIL
[WebGL test #10: Property either does not exist or is not a function: invalidateSubFramebuffer]
[WebGL test #10: Property either does not exist or is not a function: readBuffer]
expected: FAIL
[WebGL test #11: Property either does not exist or is not a function: readBuffer]
[WebGL test #11: Property either does not exist or is not a function: renderbufferStorageMultisample]
expected: FAIL
[WebGL test #12: Property either does not exist or is not a function: renderbufferStorageMultisample]
[WebGL test #12: Property either does not exist or is not a function: texImage3D]
expected: FAIL
[WebGL test #13: Property either does not exist or is not a function: texImage3D]
[WebGL test #13: Property either does not exist or is not a function: texStorage2D]
expected: FAIL
[WebGL test #14: Property either does not exist or is not a function: texStorage2D]
[WebGL test #14: Property either does not exist or is not a function: texStorage3D]
expected: FAIL
[WebGL test #15: Property either does not exist or is not a function: texStorage3D]
[WebGL test #15: Property either does not exist or is not a function: texSubImage3D]
expected: FAIL
[WebGL test #16: Property either does not exist or is not a function: texSubImage3D]
[WebGL test #16: Property either does not exist or is not a function: copyTexSubImage3D]
expected: FAIL
[WebGL test #17: Property either does not exist or is not a function: copyTexSubImage3D]
[WebGL test #17: Property either does not exist or is not a function: compressedTexImage3D]
expected: FAIL
[WebGL test #18: Property either does not exist or is not a function: compressedTexImage3D]
[WebGL test #18: Property either does not exist or is not a function: compressedTexSubImage3D]
expected: FAIL
[WebGL test #19: Property either does not exist or is not a function: compressedTexSubImage3D]
[WebGL test #19: Property either does not exist or is not a function: getFragDataLocation]
expected: FAIL
[WebGL test #20: Property either does not exist or is not a function: getFragDataLocation]
[WebGL test #20: Property either does not exist or is not a function: uniform1ui]
expected: FAIL
[WebGL test #21: Property either does not exist or is not a function: uniform1ui]
[WebGL test #21: Property either does not exist or is not a function: uniform2ui]
expected: FAIL
[WebGL test #22: Property either does not exist or is not a function: uniform2ui]
[WebGL test #22: Property either does not exist or is not a function: uniform3ui]
expected: FAIL
[WebGL test #23: Property either does not exist or is not a function: uniform3ui]
[WebGL test #23: Property either does not exist or is not a function: uniform4ui]
expected: FAIL
[WebGL test #24: Property either does not exist or is not a function: uniform4ui]
[WebGL test #24: Property either does not exist or is not a function: uniform1uiv]
expected: FAIL
[WebGL test #25: Property either does not exist or is not a function: uniform1uiv]
[WebGL test #25: Property either does not exist or is not a function: uniform2uiv]
expected: FAIL
[WebGL test #26: Property either does not exist or is not a function: uniform2uiv]
[WebGL test #26: Property either does not exist or is not a function: uniform3uiv]
expected: FAIL
[WebGL test #27: Property either does not exist or is not a function: uniform3uiv]
[WebGL test #27: Property either does not exist or is not a function: uniform4uiv]
expected: FAIL
[WebGL test #28: Property either does not exist or is not a function: uniform4uiv]
[WebGL test #28: Property either does not exist or is not a function: uniformMatrix2x3fv]
expected: FAIL
[WebGL test #29: Property either does not exist or is not a function: uniformMatrix2x3fv]
[WebGL test #29: Property either does not exist or is not a function: uniformMatrix3x2fv]
expected: FAIL
[WebGL test #30: Property either does not exist or is not a function: uniformMatrix3x2fv]
[WebGL test #30: Property either does not exist or is not a function: uniformMatrix2x4fv]
expected: FAIL
[WebGL test #31: Property either does not exist or is not a function: uniformMatrix2x4fv]
[WebGL test #31: Property either does not exist or is not a function: uniformMatrix4x2fv]
expected: FAIL
[WebGL test #32: Property either does not exist or is not a function: uniformMatrix4x2fv]
[WebGL test #32: Property either does not exist or is not a function: uniformMatrix3x4fv]
expected: FAIL
[WebGL test #33: Property either does not exist or is not a function: uniformMatrix3x4fv]
[WebGL test #33: Property either does not exist or is not a function: uniformMatrix4x3fv]
expected: FAIL
[WebGL test #34: Property either does not exist or is not a function: uniformMatrix4x3fv]
[WebGL test #34: Property either does not exist or is not a function: vertexAttribI4i]
expected: FAIL
[WebGL test #35: Property either does not exist or is not a function: vertexAttribI4i]
[WebGL test #35: Property either does not exist or is not a function: vertexAttribI4iv]
expected: FAIL
[WebGL test #36: Property either does not exist or is not a function: vertexAttribI4iv]
[WebGL test #36: Property either does not exist or is not a function: vertexAttribI4ui]
expected: FAIL
[WebGL test #37: Property either does not exist or is not a function: vertexAttribI4ui]
[WebGL test #37: Property either does not exist or is not a function: vertexAttribI4uiv]
expected: FAIL
[WebGL test #38: Property either does not exist or is not a function: vertexAttribI4uiv]
[WebGL test #38: Property either does not exist or is not a function: vertexAttribIPointer]
expected: FAIL
[WebGL test #39: Property either does not exist or is not a function: vertexAttribIPointer]
[WebGL test #39: Property either does not exist or is not a function: vertexAttribDivisor]
expected: FAIL
[WebGL test #40: Property either does not exist or is not a function: vertexAttribDivisor]
[WebGL test #40: Property either does not exist or is not a function: drawArraysInstanced]
expected: FAIL
[WebGL test #41: Property either does not exist or is not a function: drawArraysInstanced]
[WebGL test #41: Property either does not exist or is not a function: drawElementsInstanced]
expected: FAIL
[WebGL test #42: Property either does not exist or is not a function: drawElementsInstanced]
[WebGL test #42: Property either does not exist or is not a function: drawRangeElements]
expected: FAIL
[WebGL test #43: Property either does not exist or is not a function: drawRangeElements]
[WebGL test #43: Property either does not exist or is not a function: drawBuffers]
expected: FAIL
[WebGL test #44: Property either does not exist or is not a function: drawBuffers]
[WebGL test #44: Property either does not exist or is not a function: clearBufferiv]
expected: FAIL
[WebGL test #45: Property either does not exist or is not a function: clearBufferiv]
[WebGL test #45: Property either does not exist or is not a function: clearBufferuiv]
expected: FAIL
[WebGL test #46: Property either does not exist or is not a function: clearBufferuiv]
[WebGL test #46: Property either does not exist or is not a function: clearBufferfv]
expected: FAIL
[WebGL test #47: Property either does not exist or is not a function: clearBufferfv]
[WebGL test #47: Property either does not exist or is not a function: clearBufferfi]
expected: FAIL
[WebGL test #48: Property either does not exist or is not a function: clearBufferfi]
[WebGL test #48: Property either does not exist or is not a function: createQuery]
expected: FAIL
[WebGL test #49: Property either does not exist or is not a function: createQuery]
[WebGL test #49: Property either does not exist or is not a function: deleteQuery]
expected: FAIL
[WebGL test #50: Property either does not exist or is not a function: deleteQuery]
[WebGL test #50: Property either does not exist or is not a function: isQuery]
expected: FAIL
[WebGL test #51: Property either does not exist or is not a function: isQuery]
[WebGL test #51: Property either does not exist or is not a function: beginQuery]
expected: FAIL
[WebGL test #52: Property either does not exist or is not a function: beginQuery]
[WebGL test #52: Property either does not exist or is not a function: endQuery]
expected: FAIL
[WebGL test #53: Property either does not exist or is not a function: endQuery]
[WebGL test #53: Property either does not exist or is not a function: getQuery]
expected: FAIL
[WebGL test #54: Property either does not exist or is not a function: getQuery]
[WebGL test #54: Property either does not exist or is not a function: getQueryParameter]
expected: FAIL
[WebGL test #55: Property either does not exist or is not a function: getQueryParameter]
[WebGL test #55: Property either does not exist or is not a function: createSampler]
expected: FAIL
[WebGL test #56: Property either does not exist or is not a function: createSampler]
[WebGL test #56: Property either does not exist or is not a function: deleteSampler]
expected: FAIL
[WebGL test #57: Property either does not exist or is not a function: deleteSampler]
[WebGL test #57: Property either does not exist or is not a function: isSampler]
expected: FAIL
[WebGL test #58: Property either does not exist or is not a function: isSampler]
[WebGL test #58: Property either does not exist or is not a function: bindSampler]
expected: FAIL
[WebGL test #59: Property either does not exist or is not a function: bindSampler]
[WebGL test #59: Property either does not exist or is not a function: samplerParameteri]
expected: FAIL
[WebGL test #60: Property either does not exist or is not a function: samplerParameteri]
[WebGL test #60: Property either does not exist or is not a function: samplerParameterf]
expected: FAIL
[WebGL test #61: Property either does not exist or is not a function: samplerParameterf]
[WebGL test #61: Property either does not exist or is not a function: getSamplerParameter]
expected: FAIL
[WebGL test #62: Property either does not exist or is not a function: getSamplerParameter]
[WebGL test #62: Property either does not exist or is not a function: fenceSync]
expected: FAIL
[WebGL test #63: Property either does not exist or is not a function: fenceSync]
[WebGL test #63: Property either does not exist or is not a function: isSync]
expected: FAIL
[WebGL test #64: Property either does not exist or is not a function: isSync]
[WebGL test #64: Property either does not exist or is not a function: deleteSync]
expected: FAIL
[WebGL test #65: Property either does not exist or is not a function: deleteSync]
[WebGL test #65: Property either does not exist or is not a function: clientWaitSync]
expected: FAIL
[WebGL test #66: Property either does not exist or is not a function: clientWaitSync]
[WebGL test #66: Property either does not exist or is not a function: waitSync]
expected: FAIL
[WebGL test #67: Property either does not exist or is not a function: waitSync]
[WebGL test #67: Property either does not exist or is not a function: getSyncParameter]
expected: FAIL
[WebGL test #68: Property either does not exist or is not a function: getSyncParameter]
[WebGL test #68: Property either does not exist or is not a function: createTransformFeedback]
expected: FAIL
[WebGL test #69: Property either does not exist or is not a function: createTransformFeedback]
[WebGL test #69: Property either does not exist or is not a function: deleteTransformFeedback]
expected: FAIL
[WebGL test #70: Property either does not exist or is not a function: deleteTransformFeedback]
[WebGL test #70: Property either does not exist or is not a function: isTransformFeedback]
expected: FAIL
[WebGL test #71: Property either does not exist or is not a function: isTransformFeedback]
[WebGL test #71: Property either does not exist or is not a function: bindTransformFeedback]
expected: FAIL
[WebGL test #72: Property either does not exist or is not a function: bindTransformFeedback]
[WebGL test #72: Property either does not exist or is not a function: beginTransformFeedback]
expected: FAIL
[WebGL test #73: Property either does not exist or is not a function: beginTransformFeedback]
[WebGL test #73: Property either does not exist or is not a function: endTransformFeedback]
expected: FAIL
[WebGL test #74: Property either does not exist or is not a function: endTransformFeedback]
[WebGL test #74: Property either does not exist or is not a function: transformFeedbackVaryings]
expected: FAIL
[WebGL test #75: Property either does not exist or is not a function: transformFeedbackVaryings]
[WebGL test #75: Property either does not exist or is not a function: getTransformFeedbackVarying]
expected: FAIL
[WebGL test #76: Property either does not exist or is not a function: getTransformFeedbackVarying]
[WebGL test #76: Property either does not exist or is not a function: pauseTransformFeedback]
expected: FAIL
[WebGL test #77: Property either does not exist or is not a function: pauseTransformFeedback]
[WebGL test #77: Property either does not exist or is not a function: resumeTransformFeedback]
expected: FAIL
[WebGL test #78: Property either does not exist or is not a function: resumeTransformFeedback]
[WebGL test #78: Property either does not exist or is not a function: bindBufferBase]
expected: FAIL
[WebGL test #79: Property either does not exist or is not a function: bindBufferBase]
[WebGL test #79: Property either does not exist or is not a function: bindBufferRange]
expected: FAIL
[WebGL test #80: Property either does not exist or is not a function: bindBufferRange]
[WebGL test #80: Property either does not exist or is not a function: getIndexedParameter]
expected: FAIL
[WebGL test #81: Property either does not exist or is not a function: getIndexedParameter]
[WebGL test #81: Property either does not exist or is not a function: getUniformIndices]
expected: FAIL
[WebGL test #82: Property either does not exist or is not a function: getUniformIndices]
[WebGL test #82: Property either does not exist or is not a function: getActiveUniforms]
expected: FAIL
[WebGL test #83: Property either does not exist or is not a function: getActiveUniforms]
[WebGL test #83: Property either does not exist or is not a function: getUniformBlockIndex]
expected: FAIL
[WebGL test #84: Property either does not exist or is not a function: getUniformBlockIndex]
[WebGL test #84: Property either does not exist or is not a function: getActiveUniformBlockParameter]
expected: FAIL
[WebGL test #85: Property either does not exist or is not a function: getActiveUniformBlockParameter]
[WebGL test #85: Property either does not exist or is not a function: getActiveUniformBlockName]
expected: FAIL
[WebGL test #86: Property either does not exist or is not a function: getActiveUniformBlockName]
[WebGL test #86: Property either does not exist or is not a function: uniformBlockBinding]
expected: FAIL
[WebGL test #87: Property either does not exist or is not a function: uniformBlockBinding]
[WebGL test #87: Property either does not exist or is not a function: createVertexArray]
expected: FAIL
[WebGL test #88: Property either does not exist or is not a function: createVertexArray]
[WebGL test #88: Property either does not exist or is not a function: deleteVertexArray]
expected: FAIL
[WebGL test #89: Property either does not exist or is not a function: deleteVertexArray]
[WebGL test #89: Property either does not exist or is not a function: isVertexArray]
expected: FAIL
[WebGL test #90: Property either does not exist or is not a function: isVertexArray]
expected: FAIL
[WebGL test #91: Property either does not exist or is not a function: bindVertexArray]
[WebGL test #90: Property either does not exist or is not a function: bindVertexArray]
expected: FAIL

View file

@ -105,6 +105,6 @@
[WebGL test #106: getFramebufferAttachmentParameter did not generate INVALID_ENUM for invalid attachment enum: NO_ERROR]
expected: FAIL
[WebGL test #108: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
[WebGL test #121: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL