[webgl] texImage2D doesn't handle null pixels arg

RESOLVED INVALID

Status

()

RESOLVED INVALID
10 years ago
9 years ago

People

(Reporter: ilmari.heikkinen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 2 obsolete attachments)

(Reporter)

Description

10 years ago
Posted 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.
(Reporter)

Comment 1

10 years ago
Posted 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)

Comment 2

9 years ago
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.
(Reporter)

Comment 3

9 years ago
moved to Canvas: WebGL
Component: Canvas: 2D → Canvas: WebGL
QA Contact: canvas.2d → canvas.webgl

Comment 4

9 years ago
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.

Comment 5

9 years ago
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

Comment 6

9 years ago
Attachment #365150 - Attachment is obsolete: true

Comment 7

9 years ago
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
Last Resolved: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.