[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Adding internalformat param to all texImage2d variants
On May 18, 2010, at 2:29 PM, Cedric Vivier wrote:
> On Wed, May 19, 2010 at 00:21, Chris Marrin <email@example.com> wrote:
>> If I have an image that is 2 channels (LA) and my shader expects it to be RGB, I won't get reasonable results, right? If so I don't think having the format automatically set is very useful.
> I assume you would get reasonable results. From a shader perspective
> everything returned from texture samplers is expanded to RGBA
> regardless the format, so for such a scenario the shader expecting RGB
> will get the equivalent "luminance color" (L,L,L,1.0) for (R,G,B,A) -
> [sections 3.7 and 3.8 of ES 2.0 spec].
> Defining conversions other than the direct conversions defined by ES
> for sampling/pixel-packing would probably not be that useful and quite
> difficult to define for everyone as Gregg pointed out.
> As said earlier it only makes sense for a developer to specify desired
> internalformat of a DOM element texture in specific (and useful) cases
> : if he has full control of the assets and intended usage, e.g for
> sure I only need the alpha-channel from that image - or - I need only
> RGB from that image - or - I need luminance from that image that is
> known to be L or LA ... but *not* RGB or RGBA).
> Hence the need for DOM helpers to support and strongly recommend
> 0/NONE that performs _no conversion_ from the optimal format used by
> an implementation for the give image (it gives same results even if an
> implementation loads every image in RGBA, if it can load only
> necessary channels as in Chris's table it's only more efficient but
> results are the strictly the same).
NONE or NO_CONVERSION would not literally perform no conversion on the input image. It would rather make a texture that matches the original image format. Since WebKit/Chrome and Firefox both store images internally in RGBA (converting images from 1 or 2 channel formats if needed), specifying NO_CONVERSION of a 1 channel image will actually have to convert it back from RGBA to 1 channel. Of course that's an implementation detail and we could always store the original format for avoid that double conversion. But I can't see doing that in WebKit in the short term anyway...
You are currently subscribe to firstname.lastname@example.org.
To unsubscribe, send an email to email@example.com with
the following command in the body of your email: