| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
| 9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
| 10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
| 11 #include "core/html/HTMLVideoElement.h" | 11 #include "core/html/HTMLVideoElement.h" |
| 12 #include "core/html/ImageData.h" | 12 #include "core/html/ImageData.h" |
| 13 #include "gpu/command_buffer/client/gles2_interface.h" | 13 #include "gpu/command_buffer/client/gles2_interface.h" |
| 14 #include "modules/webgl/WebGLActiveInfo.h" | 14 #include "modules/webgl/WebGLActiveInfo.h" |
| 15 #include "modules/webgl/WebGLBuffer.h" | 15 #include "modules/webgl/WebGLBuffer.h" |
| 16 #include "modules/webgl/WebGLFenceSync.h" | 16 #include "modules/webgl/WebGLFenceSync.h" |
| 17 #include "modules/webgl/WebGLFramebuffer.h" | 17 #include "modules/webgl/WebGLFramebuffer.h" |
| 18 #include "modules/webgl/WebGLProgram.h" | 18 #include "modules/webgl/WebGLProgram.h" |
| 19 #include "modules/webgl/WebGLQuery.h" | 19 #include "modules/webgl/WebGLQuery.h" |
| 20 #include "modules/webgl/WebGLRenderbuffer.h" | 20 #include "modules/webgl/WebGLRenderbuffer.h" |
| 21 #include "modules/webgl/WebGLSampler.h" | 21 #include "modules/webgl/WebGLSampler.h" |
| 22 #include "modules/webgl/WebGLSync.h" | 22 #include "modules/webgl/WebGLSync.h" |
| 23 #include "modules/webgl/WebGLTexture.h" | 23 #include "modules/webgl/WebGLTexture.h" |
| 24 #include "modules/webgl/WebGLTransformFeedback.h" | 24 #include "modules/webgl/WebGLTransformFeedback.h" |
| 25 #include "modules/webgl/WebGLUniformLocation.h" | 25 #include "modules/webgl/WebGLUniformLocation.h" |
| 26 #include "modules/webgl/WebGLVertexArrayObject.h" | 26 #include "modules/webgl/WebGLVertexArrayObject.h" |
| 27 #include "platform/CheckedInt.h" | 27 #include "platform/CheckedInt.h" |
| 28 #include "platform/NotImplemented.h" |
| 28 #include "public/platform/WebGraphicsContext3D.h" | 29 #include "public/platform/WebGraphicsContext3D.h" |
| 29 #include "public/platform/WebGraphicsContext3DProvider.h" | 30 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 30 #include "wtf/OwnPtr.h" | 31 #include "wtf/OwnPtr.h" |
| 31 #include "wtf/PassOwnPtr.h" | 32 #include "wtf/PassOwnPtr.h" |
| 32 #include "wtf/text/WTFString.h" | 33 #include "wtf/text/WTFString.h" |
| 33 | 34 |
| 34 using WTF::String; | 35 using WTF::String; |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 return; | 972 return; |
| 972 if (!validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, target,
level, internalformat, width, height, depth, border, format, type, 0, 0, 0)) | 973 if (!validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, target,
level, internalformat, width, height, depth, border, format, type, 0, 0, 0)) |
| 973 return; | 974 return; |
| 974 if (!validateTexFuncData("texImage3D", Tex3D, level, width, height, depth, f
ormat, type, pixels, NullAllowed)) | 975 if (!validateTexFuncData("texImage3D", Tex3D, level, width, height, depth, f
ormat, type, pixels, NullAllowed)) |
| 975 return; | 976 return; |
| 976 | 977 |
| 977 void* data = pixels ? pixels->baseAddress() : 0; | 978 void* data = pixels ? pixels->baseAddress() : 0; |
| 978 Vector<uint8_t> tempData; | 979 Vector<uint8_t> tempData; |
| 979 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 980 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
| 980 // FIXME: WebGLImageConversion needs to be updated to accept image depth
. | 981 // FIXME: WebGLImageConversion needs to be updated to accept image depth
. |
| 981 NOTIMPLEMENTED(); | 982 notImplemented(); |
| 982 return; | 983 return; |
| 983 } | 984 } |
| 984 | 985 |
| 985 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform
at, type), width, height, depth, border, format, type, data); | 986 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform
at, type), width, height, depth, border, format, type, data); |
| 986 } | 987 } |
| 987 | 988 |
| 988 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in
ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum
format, GLenum type, GLintptr offset) | 989 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in
ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum
format, GLenum type, GLintptr offset) |
| 989 { | 990 { |
| 990 if (isContextLost()) | 991 if (isContextLost()) |
| 991 return; | 992 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceArrayBufferView, ta
rget, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset
)) | 1045 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceArrayBufferView, ta
rget, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset
)) |
| 1045 return; | 1046 return; |
| 1046 if (!validateTexFuncData("texSubImage3D", Tex3D, level, width, height, depth
, format, type, pixels, NullNotAllowed)) | 1047 if (!validateTexFuncData("texSubImage3D", Tex3D, level, width, height, depth
, format, type, pixels, NullNotAllowed)) |
| 1047 return; | 1048 return; |
| 1048 | 1049 |
| 1049 void* data = pixels->baseAddress(); | 1050 void* data = pixels->baseAddress(); |
| 1050 Vector<uint8_t> tempData; | 1051 Vector<uint8_t> tempData; |
| 1051 bool changeUnpackParameters = false; | 1052 bool changeUnpackParameters = false; |
| 1052 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 1053 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
| 1053 // FIXME: WebGLImageConversion needs to be updated to accept image depth
. | 1054 // FIXME: WebGLImageConversion needs to be updated to accept image depth
. |
| 1054 NOTIMPLEMENTED(); | 1055 notImplemented(); |
| 1055 changeUnpackParameters = true; | 1056 changeUnpackParameters = true; |
| 1056 } | 1057 } |
| 1057 if (changeUnpackParameters) | 1058 if (changeUnpackParameters) |
| 1058 resetUnpackParameters(); | 1059 resetUnpackParameters(); |
| 1059 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
height, depth, format, type, data); | 1060 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
height, depth, format, type, data); |
| 1060 if (changeUnpackParameters) | 1061 if (changeUnpackParameters) |
| 1061 restoreUnpackParameters(); | 1062 restoreUnpackParameters(); |
| 1062 } | 1063 } |
| 1063 | 1064 |
| 1064 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei d
epth, GLenum format, GLenum type, GLintptr offset) | 1065 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei d
epth, GLenum format, GLenum type, GLintptr offset) |
| (...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 params.skipPixels = m_unpackSkipPixels; | 3614 params.skipPixels = m_unpackSkipPixels; |
| 3614 params.skipRows = m_unpackSkipRows; | 3615 params.skipRows = m_unpackSkipRows; |
| 3615 if (dimension == Tex3D) { | 3616 if (dimension == Tex3D) { |
| 3616 params.imageHeight = m_unpackImageHeight; | 3617 params.imageHeight = m_unpackImageHeight; |
| 3617 params.skipImages = m_unpackSkipImages; | 3618 params.skipImages = m_unpackSkipImages; |
| 3618 } | 3619 } |
| 3619 return params; | 3620 return params; |
| 3620 } | 3621 } |
| 3621 | 3622 |
| 3622 } // namespace blink | 3623 } // namespace blink |
| OLD | NEW |