Closed Bug 481151 Opened 15 years ago Closed 14 years ago

[webgl] texImage2D doesn't handle null pixels arg

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ilmari.heikkinen, Unassigned)

Details

Attachments

(2 files, 2 obsolete files)

Attached file Testcase for gl.texImage2D (obsolete) —
nsCanvasRenderingContextGLWeb20::TexImage2D has if (argc != 3) return NS_ERROR_DOM_SYNTAX_ERR;, but the function actually takes 9 arguments.

Also, texImage2D should be able to take a null pointer as an argument (to avoid having to create and upload a texture for an FBO.)

How to reproduce:
1. gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, [0,0,0,0])
2. gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null)

What happened:
It threw an error on both.

What I expected to happen:
It should've uploaded a 1x1 texture.
Attached patch Patch for TexImage2D (obsolete) — Splinter Review
Fixes the argc bug, adds support for NULL textures and adds the rest of GLES 2.0 valid texture targets (i.e. GL_TEXTURE_CUBE_MAP_*.)
Attachment #365151 - Flags: review?(vladimir)
This bug should probably be in Component "Canvas: WebGL".

gl.texImage2D does still not support 'null' data when using the 9 arguemnt variant. It writes "texImage2D: argument error" on console and throws an exception.

I'm using 3.7a1pre Nightly 20091123 on Linux x86_64.
moved to Canvas: WebGL
Component: Canvas: 2D → Canvas: WebGL
QA Contact: canvas.2d → canvas.webgl
looking at tip/WebGLContextGL::TexImage2D, line 3135 does a !argPixelsObj check - this is what's causing the error. It looks like the code below properly handles the argPixelsObj == NULL case, so this must have just gotten messed up in a merge.
Looks like the changes from the original patch are already in except for the null pixels arg check.
Summary: [c3d] texImage2D expects the wrong number of arguments → [webgl] texImage2D doesn't handle null pixels arg
Attachment #365150 - Attachment is obsolete: true
Everything else from the old patch seems to be in already.
This fixes the early null check.
Attachment #365151 - Attachment is obsolete: true
Attachment #416475 - Flags: review?(vladimir)
Attachment #365151 - Flags: review?(vladimir)
Obsoleted by quickstubs (arg conversion happens earlier, null is handled explicitly)
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: