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

Impl copyTexImage2D and copyTexSubImage2D #11147

Merged
merged 1 commit into from May 24, 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

Large diffs are not rendered by default.

@@ -309,7 +309,7 @@ impl WebGLTexture {
true
}

fn image_info_at_face(&self, face: u8, level: u32) -> ImageInfo {
pub fn image_info_at_face(&self, face: u8, level: u32) -> ImageInfo {
let pos = (level * self.face_count.get() as u32) + face as u32;
self.image_info_array.borrow()[pos as usize]
}
@@ -340,7 +340,7 @@ impl Drop for WebGLTexture {
}

#[derive(Clone, Copy, PartialEq, Debug, JSTraceable, HeapSizeOf)]
struct ImageInfo {
pub struct ImageInfo {
width: u32,
height: u32,
depth: u32,
@@ -359,6 +359,18 @@ impl ImageInfo {
}
}

pub fn width(&self) -> u32 {
self.width
}

pub fn height(&self) -> u32 {
self.height
}

pub fn internal_format(&self) -> Option<u32> {
self.internal_format
}

fn is_power_of_two(&self) -> bool {
self.width.is_power_of_two() && self.height.is_power_of_two() && self.depth.is_power_of_two()
}
@@ -523,11 +523,13 @@ interface WebGLRenderingContextBase
GLsizei width, GLsizei height, GLenum format,
object data);

//void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
// GLint x, GLint y, GLsizei width, GLsizei height,
// GLint border);
//void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLint x, GLint y, GLsizei width, GLsizei height);
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border);
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height);

WebGLBuffer? createBuffer();
WebGLFramebuffer? createFramebuffer();

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,5 +1,14 @@
[copy-tex-image-2d-formats.html]
type: testharness
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
[WebGL test #3: getError expected: NO_ERROR. Was INVALID_ENUM : should be no errors]
expected: FAIL
[WebGL test #6: getError expected: NO_ERROR. Was INVALID_ENUM : should be no errors]
expected: FAIL
[WebGL test #9: getError expected: NO_ERROR. Was INVALID_ENUM : should be no errors]
expected: FAIL
[WebGL test #12: getError expected: NO_ERROR. Was INVALID_ENUM : should be no errors]
expected: FAIL
[WebGL test #15: getError expected: NO_ERROR. Was INVALID_ENUM : should be no errors]
expected: FAIL
[WebGL test #16: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

@@ -1,10 +1,5 @@
[texture-npot.html]
type: testharness
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

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

[WebGL test #4: at (0, 0) expected: 0,0,0,255 was 192,0,128,64]
expected: FAIL
@@ -15,6 +10,110 @@
[WebGL test #7: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #9: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
[WebGL test #9: getError expected: INVALID_VALUE. Was INVALID_ENUM : copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.]
expected: FAIL

[WebGL test #12: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #14: getError expected: NO_ERROR. Was INVALID_OPERATION : gl.texImage2D with NPOT texture at level 0 should succeed]
expected: FAIL

[WebGL test #17: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #19: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #20: at (0, 0) expected: 192,0,128,255 was 0,0,0,255]
expected: FAIL

[WebGL test #21: getError expected: INVALID_VALUE. Was INVALID_ENUM : copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.]
expected: FAIL

[WebGL test #24: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #26: getError expected: NO_ERROR. Was INVALID_OPERATION : gl.texImage2D with NPOT texture at level 0 should succeed]
expected: FAIL

[WebGL test #29: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #31: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #32: at (0, 0) expected: 192,192,192,255 was 0,0,0,255]
expected: FAIL

[WebGL test #33: getError expected: INVALID_VALUE. Was INVALID_ENUM : copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.]
expected: FAIL

[WebGL test #36: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #38: getError expected: NO_ERROR. Was INVALID_OPERATION : gl.texImage2D with NPOT texture at level 0 should succeed]
expected: FAIL

[WebGL test #41: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #43: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #44: at (0, 0) expected: 0,0,0,64 was 0,0,0,255]
expected: FAIL

[WebGL test #45: getError expected: INVALID_VALUE. Was INVALID_ENUM : copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.]
expected: FAIL

[WebGL test #48: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #50: getError expected: NO_ERROR. Was INVALID_OPERATION : gl.texImage2D with NPOT texture at level 0 should succeed]
expected: FAIL

[WebGL test #53: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #55: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #56: at (0, 0) expected: 192,192,192,64 was 0,0,0,255]
expected: FAIL

[WebGL test #57: getError expected: INVALID_VALUE. Was INVALID_ENUM : copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.]
expected: FAIL

[WebGL test #60: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #64: at (0, 0) expected: 0,0,0,255 was 0,192,128,255]
expected: FAIL

[WebGL test #65: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from draw.]
expected: FAIL

[WebGL test #67: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #69: getError expected: NO_ERROR. Was INVALID_ENUM : gl.texImage2D with POT texture at level 0 should succeed]
expected: FAIL

[WebGL test #71: getError expected: NO_ERROR. Was INVALID_ENUM : gl.generateMipmap with POT texture should return succeed]
expected: FAIL

[WebGL test #76: at (0, 0) expected: 0,0,0,255 was 0,192,128,255]
expected: FAIL

[WebGL test #77: getError returned INVALID_ENUM. Possibly Chromium bug where texture unit is set to 0 instead of GL_TEXTURE0.]
expected: FAIL

[WebGL test #79: getError expected: NO_ERROR. Was INVALID_ENUM : Should be no errors from setup.]
expected: FAIL

[WebGL test #81: getError expected: NO_ERROR. Was INVALID_ENUM : gl.texImage2D with POT texture at level 0 should succeed]
expected: FAIL

[WebGL test #83: getError expected: NO_ERROR. Was INVALID_ENUM : gl.generateMipmap with POT texture should return succeed]
expected: FAIL
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.