|
Lines 3868-3880
void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec1
|
| 3868 |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
3868 |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
| 3869 |
// If possible, copy from the canvas element directly to the texture |
3869 |
// If possible, copy from the canvas element directly to the texture |
| 3870 |
// via the GPU, without a read-back to system memory. |
3870 |
// via the GPU, without a read-back to system memory. |
| 3871 |
// |
3871 |
if (GraphicsContext3D::TEXTURE_2D == target && texture) { |
| 3872 |
// FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE should be lifted when |
|
|
| 3873 |
// ImageBuffer::copyToPlatformTexture implementations are fully functional. |
| 3874 |
if (GraphicsContext3D::TEXTURE_2D == target && texture && type == texture->getType(target, level) |
| 3875 |
&& (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA) && type == GraphicsContext3D::UNSIGNED_BYTE) { |
| 3876 |
ImageBuffer* buffer = canvas->buffer(); |
3872 |
ImageBuffer* buffer = canvas->buffer(); |
| 3877 |
if (buffer && buffer->copyToPlatformTexture(*m_context.get(), texture->object(), internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
3873 |
if (buffer && buffer->copyToPlatformTexture(*m_context.get(), texture->object(), internalformat, type, level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
| 3878 |
texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas->height(), type); |
3874 |
texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas->height(), type); |
| 3879 |
cleanupAfterGraphicsCall(false); |
3875 |
cleanupAfterGraphicsCall(false); |
| 3880 |
return; |
3876 |
return; |
|
Lines 3913-3926
void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec2
|
| 3913 |
|
3909 |
|
| 3914 |
// Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible. |
3910 |
// Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible. |
| 3915 |
// Otherwise, it will fall back to the normal SW path. |
3911 |
// Otherwise, it will fall back to the normal SW path. |
| 3916 |
// FIXME: The current restrictions require that format shoud be RGB or RGBA, |
|
|
| 3917 |
// type should be UNSIGNED_BYTE and level should be 0. It may be lifted in the future. |
| 3918 |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
3912 |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
| 3919 |
if (GraphicsContext3D::TEXTURE_2D == target && texture |
3913 |
if (GraphicsContext3D::TEXTURE_2D == target && texture) { |
| 3920 |
&& (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA) |
|
|
| 3921 |
&& type == GraphicsContext3D::UNSIGNED_BYTE |
| 3922 |
&& (texture->getType(target, level) == GraphicsContext3D::UNSIGNED_BYTE || !texture->isValid(target, level)) |
| 3923 |
&& !level) { |
| 3924 |
if (video->copyVideoTextureToPlatformTexture(m_context.get(), texture->object(), level, type, internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
3914 |
if (video->copyVideoTextureToPlatformTexture(m_context.get(), texture->object(), level, type, internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
| 3925 |
texture->setLevelInfo(target, level, internalformat, video->videoWidth(), video->videoHeight(), type); |
3915 |
texture->setLevelInfo(target, level, internalformat, video->videoWidth(), video->videoHeight(), type); |
| 3926 |
cleanupAfterGraphicsCall(false); |
3916 |
cleanupAfterGraphicsCall(false); |