[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] copyTexImage2D and copyTexSubImage2D





On Thu, Dec 23, 2010 at 2:24 PM, Kenneth Russell <kbr@google.com> wrote:
Yes. One way of implementing this moderately efficiently would be to
check whether the copyTexImage2D call will read any pixels outside the
framebuffer. If not, just call glCopyTexImage2D. If so, initialize the
texture to 0 and then use glCopyTexSubImage2D.

Yes, that's how it's implemented in Chrome.

Check if any pixels are out of bounds
   If no
      call glCopyTexSubImage2D
   If yes
      call glTexSubImage2D with a zeroed buffer clear out the requested rect.
      call glCopyTexSubImage2D to copy just the in bounds area to the correct spot.

There is one minor issue. If it's possible for glCopyTexSubImage2D to fail then the texture will be left cleared even though failure is supposed to mean nothing happened. For now I'm assuming it won't fail. And besides, copying out of bounds not common (except for trying to break security) so I'm really not to concerned about perf or other issues for that case.
 

-Ken

On Thu, Dec 23, 2010 at 5:18 PM, Gregg Tavares (wrk) <gman@google.com> wrote:
> This is mostly already speced.
>
> Section 4.1
> "WebGL resources such as textures and vertex buffer objects (VBOs) must
> always contain initialized data, even if they were created without initial
> user data values"
>
>
>
> On Thu, Dec 23, 2010 at 9:58 AM, Mo, Zhenyao <zhenyao@gmail.com> wrote:
>>
>> In WebGL spec, we say "For any pixel lying outside the frame buffer,
>> the value read contains 0 in all channels" for readPixels.  Shouldn't
>> we say the same thing for copyTexImage2D?
>>
>> As in the case of copyTexSubImage2D, pixels outside the frame buffer
>> could be cleared to 0, or could be untouched.  The latter would be
>> more efficient.  However, whatever way we decide, it should be made
>> explicit, so we could have conformance test against it.  "Undefined"
>> is unacceptable for security reasons.
>> -----------------------------------------------------------
>> You are currently subscribed to public_webgl@khronos.org.
>> To unsubscribe, send an email to majordomo@khronos.org with
>> the following command in the body of your email:
>>
>
>