|
Lines 49-54
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec1
|
| 49 |
#include "OESElementIndexUint.h" |
49 |
#include "OESElementIndexUint.h" |
| 50 |
#include "OESStandardDerivatives.h" |
50 |
#include "OESStandardDerivatives.h" |
| 51 |
#include "OESTextureFloat.h" |
51 |
#include "OESTextureFloat.h" |
|
|
52 |
#include "OESTextureHalfFloat.h" |
| 52 |
#include "OESVertexArrayObject.h" |
53 |
#include "OESVertexArrayObject.h" |
| 53 |
#include "Page.h" |
54 |
#include "Page.h" |
| 54 |
#include "RenderBox.h" |
55 |
#include "RenderBox.h" |
|
Lines 2382-2387
WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec2
|
| 2382 |
} |
2383 |
} |
| 2383 |
return m_oesTextureFloat.get(); |
2384 |
return m_oesTextureFloat.get(); |
| 2384 |
} |
2385 |
} |
|
|
2386 |
if (equalIgnoringCase(name, "OES_texture_half_float") |
| 2387 |
&& m_context->getExtensions()->supports("GL_OES_texture_half_float")) { |
| 2388 |
if (!m_oesTextureHalfFloat) { |
| 2389 |
m_context->getExtensions()->ensureEnabled("GL_OES_texture_half_float"); |
| 2390 |
m_oesTextureHalfFloat = OESTextureHalfFloat::create(this); |
| 2391 |
} |
| 2392 |
return m_oesTextureHalfFloat.get(); |
| 2393 |
} |
| 2385 |
if (equalIgnoringCase(name, "OES_vertex_array_object") |
2394 |
if (equalIgnoringCase(name, "OES_vertex_array_object") |
| 2386 |
&& m_context->getExtensions()->supports("GL_OES_vertex_array_object")) { |
2395 |
&& m_context->getExtensions()->supports("GL_OES_vertex_array_object")) { |
| 2387 |
if (!m_oesVertexArrayObject) { |
2396 |
if (!m_oesVertexArrayObject) { |
|
Lines 3767-3772
void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec3
|
| 3767 |
return; |
3776 |
return; |
| 3768 |
if (!validateSettableTexFormat("texImage2D", format)) |
3777 |
if (!validateSettableTexFormat("texImage2D", format)) |
| 3769 |
return; |
3778 |
return; |
|
|
3779 |
// FIXME: Uploading ImageData to half floating point texture is not supported yet |
| 3780 |
// https://bugs.webkit.org/show_bug.cgi?id=110936 |
| 3781 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 3782 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet"); |
| 3783 |
return; |
| 3784 |
} |
| 3785 |
|
| 3770 |
bool needConversion = true; |
3786 |
bool needConversion = true; |
| 3771 |
// The data from ImageData is always of format RGBA8. |
3787 |
// The data from ImageData is always of format RGBA8. |
| 3772 |
// No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required. |
3788 |
// No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required. |
|
Lines 3797-3802
void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec4
|
| 3797 |
ec = SECURITY_ERR; |
3813 |
ec = SECURITY_ERR; |
| 3798 |
return; |
3814 |
return; |
| 3799 |
} |
3815 |
} |
|
|
3816 |
// Uploading ImageElement to half floating point texture is not supported yet |
| 3817 |
// https://bugs.webkit.org/show_bug.cgi?id=111194 |
| 3818 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 3819 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet"); |
| 3820 |
return; |
| 3821 |
} |
| 3800 |
|
3822 |
|
| 3801 |
texImage2DImpl(target, level, internalformat, format, type, image->cachedImage()->imageForRenderer(image->renderer()), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
3823 |
texImage2DImpl(target, level, internalformat, format, type, image->cachedImage()->imageForRenderer(image->renderer()), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
| 3802 |
} |
3824 |
} |
|
Lines 3819-3824
void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec5
|
| 3819 |
return; |
3841 |
return; |
| 3820 |
if (!validateSettableTexFormat("texImage2D", format)) |
3842 |
if (!validateSettableTexFormat("texImage2D", format)) |
| 3821 |
return; |
3843 |
return; |
|
|
3844 |
// Uploading HTMLCanvasElement to half floating point texture is not supported yet |
| 3845 |
// https://bugs.webkit.org/show_bug.cgi?id=111196 |
| 3846 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 3847 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet"); |
| 3848 |
return; |
| 3849 |
} |
| 3822 |
|
3850 |
|
| 3823 |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
3851 |
WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); |
| 3824 |
// If possible, copy from the canvas element directly to the texture |
3852 |
// If possible, copy from the canvas element directly to the texture |
|
Lines 3875-3880
void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec6
|
| 3875 |
RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), ec); |
3903 |
RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), ec); |
| 3876 |
if (!image) |
3904 |
if (!image) |
| 3877 |
return; |
3905 |
return; |
|
|
3906 |
// Uploading HTMLVideoElement to half floating point texture is not supported yet |
| 3907 |
// https://bugs.webkit.org/show_bug.cgi?id=111197 |
| 3908 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 3909 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texImage2D", "Operation not supported yet"); |
| 3910 |
return; |
| 3911 |
} |
| 3912 |
|
| 3878 |
texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
3913 |
texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
| 3879 |
} |
3914 |
} |
| 3880 |
#endif |
3915 |
#endif |
|
Lines 4029-4034
void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec7
|
| 4029 |
return; |
4064 |
return; |
| 4030 |
if (!validateSettableTexFormat("texSubImage2D", format)) |
4065 |
if (!validateSettableTexFormat("texSubImage2D", format)) |
| 4031 |
return; |
4066 |
return; |
|
|
4067 |
// Uploading ImageData to half floating point texture is not supported yet |
| 4068 |
// https://bugs.webkit.org/show_bug.cgi?id=110936 |
| 4069 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 4070 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); |
| 4071 |
return; |
| 4072 |
} |
| 4073 |
|
| 4032 |
Vector<uint8_t> data; |
4074 |
Vector<uint8_t> data; |
| 4033 |
bool needConversion = true; |
4075 |
bool needConversion = true; |
| 4034 |
// The data from ImageData is always of format RGBA8. |
4076 |
// The data from ImageData is always of format RGBA8. |
|
Lines 4060-4065
void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec8
|
| 4060 |
ec = SECURITY_ERR; |
4102 |
ec = SECURITY_ERR; |
| 4061 |
return; |
4103 |
return; |
| 4062 |
} |
4104 |
} |
|
|
4105 |
// Uploading HTMLImageElement to half floating point texture is not supported yet |
| 4106 |
// https://bugs.webkit.org/show_bug.cgi?id=111194 |
| 4107 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 4108 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); |
| 4109 |
return; |
| 4110 |
} |
| 4111 |
|
| 4063 |
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image->cachedImage()->imageForRenderer(image->renderer()), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
4112 |
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image->cachedImage()->imageForRenderer(image->renderer()), GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
| 4064 |
} |
4113 |
} |
| 4065 |
|
4114 |
|
|
Lines 4081-4086
void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec9
|
| 4081 |
return; |
4130 |
return; |
| 4082 |
if (!validateSettableTexFormat("texSubImage2D", format)) |
4131 |
if (!validateSettableTexFormat("texSubImage2D", format)) |
| 4083 |
return; |
4132 |
return; |
|
|
4133 |
// Uploading HTMLCanvasElement to half floating point texture is not supported yet |
| 4134 |
// https://bugs.webkit.org/show_bug.cgi?id=111196 |
| 4135 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 4136 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); |
| 4137 |
return; |
| 4138 |
} |
| 4139 |
|
| 4084 |
RefPtr<ImageData> imageData = canvas->getImageData(); |
4140 |
RefPtr<ImageData> imageData = canvas->getImageData(); |
| 4085 |
if (imageData) |
4141 |
if (imageData) |
| 4086 |
texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.get(), ec); |
4142 |
texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.get(), ec); |
|
Lines 4098-4103
void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec10
|
| 4098 |
RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), ec); |
4154 |
RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), ec); |
| 4099 |
if (!image) |
4155 |
if (!image) |
| 4100 |
return; |
4156 |
return; |
|
|
4157 |
// Uploading HTMLVideoElement to half floating point texture is not supported yet |
| 4158 |
// https://bugs.webkit.org/show_bug.cgi?id=111197 |
| 4159 |
if (type == GraphicsContext3D::HALF_FLOAT_OES) { |
| 4160 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "texSubImage2D", "Operation not supported yet"); |
| 4161 |
return; |
| 4162 |
} |
| 4163 |
|
| 4101 |
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
4164 |
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec); |
| 4102 |
} |
4165 |
} |
| 4103 |
#endif |
4166 |
#endif |
|
Lines 4980-4985
bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec11
|
| 4980 |
break; |
5043 |
break; |
| 4981 |
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type"); |
5044 |
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type"); |
| 4982 |
return false; |
5045 |
return false; |
|
|
5046 |
case GraphicsContext3D::HALF_FLOAT_OES: |
| 5047 |
if (m_oesTextureHalfFloat) |
| 5048 |
break; |
| 5049 |
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture type"); |
| 5050 |
return false; |
| 4983 |
case GraphicsContext3D::UNSIGNED_INT: |
5051 |
case GraphicsContext3D::UNSIGNED_INT: |
| 4984 |
case GraphicsContext3D::UNSIGNED_INT_24_8: |
5052 |
case GraphicsContext3D::UNSIGNED_INT_24_8: |
| 4985 |
case GraphicsContext3D::UNSIGNED_SHORT: |
5053 |
case GraphicsContext3D::UNSIGNED_SHORT: |
|
Lines 4998-5004
bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec12
|
| 4998 |
case GraphicsContext3D::LUMINANCE: |
5066 |
case GraphicsContext3D::LUMINANCE: |
| 4999 |
case GraphicsContext3D::LUMINANCE_ALPHA: |
5067 |
case GraphicsContext3D::LUMINANCE_ALPHA: |
| 5000 |
if (type != GraphicsContext3D::UNSIGNED_BYTE |
5068 |
if (type != GraphicsContext3D::UNSIGNED_BYTE |
| 5001 |
&& type != GraphicsContext3D::FLOAT) { |
5069 |
&& type != GraphicsContext3D::FLOAT |
|
|
5070 |
&& type != GraphicsContext3D::HALF_FLOAT_OES) { |
| 5002 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for format"); |
5071 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for format"); |
| 5003 |
return false; |
5072 |
return false; |
| 5004 |
} |
5073 |
} |
|
Lines 5006-5012
bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec13
|
| 5006 |
case GraphicsContext3D::RGB: |
5075 |
case GraphicsContext3D::RGB: |
| 5007 |
if (type != GraphicsContext3D::UNSIGNED_BYTE |
5076 |
if (type != GraphicsContext3D::UNSIGNED_BYTE |
| 5008 |
&& type != GraphicsContext3D::UNSIGNED_SHORT_5_6_5 |
5077 |
&& type != GraphicsContext3D::UNSIGNED_SHORT_5_6_5 |
| 5009 |
&& type != GraphicsContext3D::FLOAT) { |
5078 |
&& type != GraphicsContext3D::FLOAT |
|
|
5079 |
&& type != GraphicsContext3D::HALF_FLOAT_OES) { |
| 5010 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for RGB format"); |
5080 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for RGB format"); |
| 5011 |
return false; |
5081 |
return false; |
| 5012 |
} |
5082 |
} |
|
Lines 5015-5021
bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec14
|
| 5015 |
if (type != GraphicsContext3D::UNSIGNED_BYTE |
5085 |
if (type != GraphicsContext3D::UNSIGNED_BYTE |
| 5016 |
&& type != GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4 |
5086 |
&& type != GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4 |
| 5017 |
&& type != GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1 |
5087 |
&& type != GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1 |
| 5018 |
&& type != GraphicsContext3D::FLOAT) { |
5088 |
&& type != GraphicsContext3D::FLOAT |
|
|
5089 |
&& type != GraphicsContext3D::HALF_FLOAT_OES) { |
| 5019 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for RGBA format"); |
5090 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "invalid type for RGBA format"); |
| 5020 |
return false; |
5091 |
return false; |
| 5021 |
} |
5092 |
} |
|
Lines 5185-5190
bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Din
a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp_sec15
|
| 5185 |
return false; |
5256 |
return false; |
| 5186 |
} |
5257 |
} |
| 5187 |
break; |
5258 |
break; |
|
|
5259 |
case GraphicsContext3D::HALF_FLOAT_OES: // OES_texture_half_float |
| 5260 |
// As per the specification, ArrayBufferView should be null when |
| 5261 |
// OES_texture_half_float is enabled. |
| 5262 |
if (pixels) { |
| 5263 |
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type HALF_FLOAT_OES but ArrayBufferView is not NULL"); |
| 5264 |
return false; |
| 5265 |
} |
| 5266 |
break; |
| 5188 |
default: |
5267 |
default: |
| 5189 |
ASSERT_NOT_REACHED(); |
5268 |
ASSERT_NOT_REACHED(); |
| 5190 |
} |
5269 |
} |