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 GetActiveAttrib #10379

Merged
merged 1 commit into from Apr 12, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -167,6 +167,17 @@ impl WebGLProgram {
WebGLActiveInfo::new(self.global().r(), size, ty, DOMString::from(name)))
}

/// glGetActiveAttrib
pub fn get_active_attrib(&self, index: u32) -> WebGLResult<Root<WebGLActiveInfo>> {
let (sender, receiver) = ipc::channel().unwrap();
self.renderer
.send(CanvasMsg::WebGL(WebGLCommand::GetActiveAttrib(self.id, index, sender)))
.unwrap();

receiver.recv().unwrap().map(|(size, ty, name)|
WebGLActiveInfo::new(self.global().r(), size, ty, DOMString::from(name)))
}

/// glGetAttribLocation
pub fn get_attrib_location(&self, name: DOMString) -> WebGLResult<Option<i32>> {
if name.len() > MAX_UNIFORM_AND_ATTRIBUTE_LEN {
@@ -827,6 +827,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
})
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn GetActiveAttrib(&self, program: Option<&WebGLProgram>, index: u32) -> Option<Root<WebGLActiveInfo>> {
program.and_then(|p| match p.get_active_attrib(index) {
Ok(ret) => Some(ret),
Err(error) => {
self.webgl_error(error);
None
},
})
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn GetAttribLocation(&self, program: Option<&WebGLProgram>, name: DOMString) -> i32 {
if let Some(program) = program {
@@ -567,7 +567,7 @@ interface WebGLRenderingContextBase

void generateMipmap(GLenum target);

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

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