Closed Bug 1024149 Opened 10 years ago Closed 8 years ago

webgl-1.0.3 conformance failure texture upload size

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: wlitwinczyk, Assigned: mtseng)

Details

Attachments

(1 file)

http://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/texture-upload-size.html

When an SVG is resized using "img.width *= 2" the WebGLContext::TexImage2D (line 434) function recieves the old size. As far as I can tell this is an SVG issue and not something to do with WebGL. I don't know enough about how everything interacts to be sure, but from the looking around and debugging I've done this seems to be the case.
Hey Cam, can you provide any info on this? Or point to a person on SVG that can.

thanks
Dan
Flags: needinfo?(cam)
The test does this:

  img.width *= 2;
  img.height *= 2;
  if (test.isSVG) {
    testUpload(img, img.width, img.height);
  } else {
    testUpload(img, width, height);
  }

So for the PNG, it expects the texture to be the original size of the PNG, not whatever size the <img> has been stretched to.  But for SVG, it expects the texture size to be whatever size the <img> is, not the underlying intrinsic size of the SVG document.  Is this behaviour supported by the spec?  What does it say the texture size should be when texImage2D is passed an <img> (be it PNG or SVG)?
Flags: needinfo?(cam)
The spec says:

6.7 Texture Upload Width and Height

Unless width and height parameters are explicitly specified, the width and height of the texture set by texImage2D and the width and height of the sub-rectangle updated by texSubImage2D are determined based on the uploaded element or image data the following way:

[...]
HTMLImageElement image:
    If a bitmap is uploaded, the width and height of the texture are set to the width and height of the uploaded bitmap in pixels. If an SVG image is uploaded, the width and height of the texture are set to the current values of the width and height properties of image. 
[...]
Assignee: wlitwinczyk → mtseng
Status: NEW → ASSIGNED
Comment on attachment 8699866 [details] [diff] [review]
Use element size for upload texture when using SVG image.

Review of attachment 8699866 [details] [diff] [review]:
-----------------------------------------------------------------

Over to :roc for review or delegation.

::: layout/base/nsLayoutUtils.cpp
@@ +6934,5 @@
>      result.mIsPremultiplied = false;
>    }
>  
>    int32_t imgWidth, imgHeight;
> +  nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);

I can't review this properly.
Attachment #8699866 - Flags: review?(roc)
Attachment #8699866 - Flags: review?(jgilbert)
Attachment #8699866 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/3fbbaedcf495
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: