Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 1815803003: Move simple methods [T-Z] from WebGraphicsContext3D to GLES2Interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simples-fplus
Patch Set: simples-tplus: fixed Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 { 845 {
846 if (isContextLost()) 846 if (isContextLost())
847 return; 847 return;
848 if (!validateTexture2DBinding("texImage2D", target)) 848 if (!validateTexture2DBinding("texImage2D", target))
849 return; 849 return;
850 if (!validateTexFunc("texImage2D", TexImage, SourceUnpackBuffer, target, lev el, internalformat, width, height, 1, border, format, type, 0, 0, 0)) 850 if (!validateTexFunc("texImage2D", TexImage, SourceUnpackBuffer, target, lev el, internalformat, width, height, 1, border, format, type, 0, 0, 0))
851 return; 851 return;
852 if (!validateValueFitNonNegInt32("texImage2D", "offset", offset)) 852 if (!validateValueFitNonNegInt32("texImage2D", "offset", offset))
853 return; 853 return;
854 854
855 webContext()->texImage2D(target, level, convertTexInternalFormat(internalfor mat, type), width, height, border, format, type, reinterpret_cast<const void *>( offset)); 855 contextGL()->TexImage2D(target, level, convertTexInternalFormat(internalform at, type), width, height, border, format, type, reinterpret_cast<const void *>(o ffset));
856 } 856 }
857 857
858 void WebGL2RenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum ty pe, GLintptr offset) 858 void WebGL2RenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum ty pe, GLintptr offset)
859 { 859 {
860 if (isContextLost()) 860 if (isContextLost())
861 return; 861 return;
862 if (!validateTexture2DBinding("texSubImage2D", target)) 862 if (!validateTexture2DBinding("texSubImage2D", target))
863 return; 863 return;
864 if (!validateTexFunc("texSubImage2D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, 1, 0, format, type, xoffset, yoffset, 0)) 864 if (!validateTexFunc("texSubImage2D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, 1, 0, format, type, xoffset, yoffset, 0))
865 return; 865 return;
866 if (!validateValueFitNonNegInt32("texSubImage2D", "offset", offset)) 866 if (!validateValueFitNonNegInt32("texSubImage2D", "offset", offset))
867 return; 867 return;
868 868
869 webContext()->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, reinterpret_cast<const void*>(offset)); 869 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, f ormat, type, reinterpret_cast<const void*>(offset));
870 } 870 }
871 871
872 void WebGL2RenderingContextBase::texImage2D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, DOMArrayBufferView* data) 872 void WebGL2RenderingContextBase::texImage2D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, DOMArrayBufferView* data)
873 { 873 {
874 WebGLRenderingContextBase::texImage2D(target, level, internalformat, width, height, border, format, type, data); 874 WebGLRenderingContextBase::texImage2D(target, level, internalformat, width, height, border, format, type, data);
875 } 875 }
876 876
877 void WebGL2RenderingContextBase::texImage2D(GLenum target, GLint level, GLint in ternalformat, GLenum format, GLenum type, ImageData* imageData) 877 void WebGL2RenderingContextBase::texImage2D(GLenum target, GLint level, GLint in ternalformat, GLenum format, GLenum type, ImageData* imageData)
878 { 878 {
879 WebGLRenderingContextBase::texImage2D(target, level, internalformat, format, type, imageData); 879 WebGLRenderingContextBase::texImage2D(target, level, internalformat, format, type, imageData);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, Exce ptionState& exceptionState) 933 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, Exce ptionState& exceptionState)
934 { 934 {
935 WebGLRenderingContextBase::texSubImage2D(target, level, xoffset, yoffset, fo rmat, type, bitmap, exceptionState); 935 WebGLRenderingContextBase::texSubImage2D(target, level, xoffset, yoffset, fo rmat, type, bitmap, exceptionState);
936 } 936 }
937 937
938 void WebGL2RenderingContextBase::texStorage2D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height) 938 void WebGL2RenderingContextBase::texStorage2D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height)
939 { 939 {
940 if (isContextLost() || !validateTexStorage("texStorage2D", target, levels, i nternalformat, width, height, 1, TexStorageType2D)) 940 if (isContextLost() || !validateTexStorage("texStorage2D", target, levels, i nternalformat, width, height, 1, TexStorageType2D))
941 return; 941 return;
942 942
943 webContext()->texStorage2DEXT(target, levels, internalformat, width, height) ; 943 contextGL()->TexStorage2DEXT(target, levels, internalformat, width, height);
944 } 944 }
945 945
946 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth) 946 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth)
947 { 947 {
948 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D)) 948 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D))
949 return; 949 return;
950 950
951 webContext()->texStorage3D(target, levels, internalformat, width, height, de pth); 951 contextGL()->TexStorage3D(target, levels, internalformat, width, height, dep th);
952 } 952 }
953 953
954 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels) 954 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels)
955 { 955 {
956 if (isContextLost()) 956 if (isContextLost())
957 return; 957 return;
958 if (!validateTexture3DBinding("texImage3D", target)) 958 if (!validateTexture3DBinding("texImage3D", target))
959 return; 959 return;
960 if (!validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, target, level, internalformat, width, height, depth, border, format, type, 0, 0, 0)) 960 if (!validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, target, level, internalformat, width, height, depth, border, format, type, 0, 0, 0))
961 return; 961 return;
962 if (!validateTexFuncData("texImage3D", Tex3D, level, width, height, depth, f ormat, type, pixels, NullAllowed)) 962 if (!validateTexFuncData("texImage3D", Tex3D, level, width, height, depth, f ormat, type, pixels, NullAllowed))
963 return; 963 return;
964 964
965 void* data = pixels ? pixels->baseAddress() : 0; 965 void* data = pixels ? pixels->baseAddress() : 0;
966 Vector<uint8_t> tempData; 966 Vector<uint8_t> tempData;
967 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { 967 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
968 // FIXME: WebGLImageConversion needs to be updated to accept image depth . 968 // FIXME: WebGLImageConversion needs to be updated to accept image depth .
969 notImplemented(); 969 notImplemented();
970 return; 970 return;
971 } 971 }
972 972
973 webContext()->texImage3D(target, level, convertTexInternalFormat(internalfor mat, type), width, height, depth, border, format, type, data); 973 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform at, type), width, height, depth, border, format, type, data);
974 } 974 }
975 975
976 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr offset) 976 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr offset)
977 { 977 {
978 if (isContextLost()) 978 if (isContextLost())
979 return; 979 return;
980 if (!validateTexture3DBinding("texImage3D", target)) 980 if (!validateTexture3DBinding("texImage3D", target))
981 return; 981 return;
982 if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, lev el, internalformat, width, height, depth, border, format, type, 0, 0, 0)) 982 if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, lev el, internalformat, width, height, depth, border, format, type, 0, 0, 0))
983 return; 983 return;
984 if (!validateValueFitNonNegInt32("texImage3D", "offset", offset)) 984 if (!validateValueFitNonNegInt32("texImage3D", "offset", offset))
985 return; 985 return;
986 986
987 webContext()->texImage3D(target, level, convertTexInternalFormat(internalfor mat, type), width, height, depth, border, format, type, reinterpret_cast<const v oid *>(offset)); 987 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform at, type), width, height, depth, border, format, type, reinterpret_cast<const vo id *>(offset));
988 } 988 }
989 989
990 void WebGL2RenderingContextBase::texSubImage3DImpl(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, Image* i mage, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premu ltiplyAlpha) 990 void WebGL2RenderingContextBase::texSubImage3DImpl(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, Image* i mage, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premu ltiplyAlpha)
991 { 991 {
992 // All calling functions check isContextLost, so a duplicate check is not ne eded here. 992 // All calling functions check isContextLost, so a duplicate check is not ne eded here.
993 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { 993 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) {
994 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. 994 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
995 type = GL_FLOAT; 995 type = GL_FLOAT;
996 } 996 }
997 Vector<uint8_t> data; 997 Vector<uint8_t> data;
(...skipping 10 matching lines...) Expand all
1008 if (type == GL_UNSIGNED_BYTE && sourceDataFormat == WebGLImageConversion::Da taFormatRGBA8 && format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNo thing && !flipY) { 1008 if (type == GL_UNSIGNED_BYTE && sourceDataFormat == WebGLImageConversion::Da taFormatRGBA8 && format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNo thing && !flipY) {
1009 needConversion = false; 1009 needConversion = false;
1010 } else { 1010 } else {
1011 if (!WebGLImageConversion::packImageData(image, imagePixelData, format, type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtrac tor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) { 1011 if (!WebGLImageConversion::packImageData(image, imagePixelData, format, type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtrac tor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) {
1012 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data "); 1012 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data ");
1013 return; 1013 return;
1014 } 1014 }
1015 } 1015 }
1016 1016
1017 resetUnpackParameters(); 1017 resetUnpackParameters();
1018 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, imageE xtractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConver sion ? data.data() : imagePixelData); 1018 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, imageEx tractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConvers ion ? data.data() : imagePixelData);
1019 restoreUnpackParameters(); 1019 restoreUnpackParameters();
1020 } 1020 }
1021 1021
1022 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei d epth, GLenum format, GLenum type, DOMArrayBufferView* pixels) 1022 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei d epth, GLenum format, GLenum type, DOMArrayBufferView* pixels)
1023 { 1023 {
1024 if (isContextLost()) 1024 if (isContextLost())
1025 return; 1025 return;
1026 if (!validateTexture3DBinding("texSubImage3D", target)) 1026 if (!validateTexture3DBinding("texSubImage3D", target))
1027 return; 1027 return;
1028 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceArrayBufferView, ta rget, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset )) 1028 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceArrayBufferView, ta rget, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset ))
1029 return; 1029 return;
1030 if (!validateTexFuncData("texSubImage3D", Tex3D, level, width, height, depth , format, type, pixels, NullNotAllowed)) 1030 if (!validateTexFuncData("texSubImage3D", Tex3D, level, width, height, depth , format, type, pixels, NullNotAllowed))
1031 return; 1031 return;
1032 1032
1033 void* data = pixels->baseAddress(); 1033 void* data = pixels->baseAddress();
1034 Vector<uint8_t> tempData; 1034 Vector<uint8_t> tempData;
1035 bool changeUnpackParameters = false; 1035 bool changeUnpackParameters = false;
1036 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { 1036 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
1037 // FIXME: WebGLImageConversion needs to be updated to accept image depth . 1037 // FIXME: WebGLImageConversion needs to be updated to accept image depth .
1038 notImplemented(); 1038 notImplemented();
1039 changeUnpackParameters = true; 1039 changeUnpackParameters = true;
1040 } 1040 }
1041 if (changeUnpackParameters) 1041 if (changeUnpackParameters)
1042 resetUnpackParameters(); 1042 resetUnpackParameters();
1043 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data); 1043 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
1044 if (changeUnpackParameters) 1044 if (changeUnpackParameters)
1045 restoreUnpackParameters(); 1045 restoreUnpackParameters();
1046 } 1046 }
1047 1047
1048 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) 1048 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)
1049 { 1049 {
1050 if (isContextLost()) 1050 if (isContextLost())
1051 return; 1051 return;
1052 if (!validateTexture3DBinding("texSubImage3D", target)) 1052 if (!validateTexture3DBinding("texSubImage3D", target))
1053 return; 1053 return;
1054 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) 1054 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset))
1055 return; 1055 return;
1056 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) 1056 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset))
1057 return; 1057 return;
1058 1058
1059 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, reinterpret_cast<const void*>(offset)); 1059 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, reinterpret_cast<const void*>(offset));
1060 } 1060 }
1061 1061
1062 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p ixels) 1062 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p ixels)
1063 { 1063 {
1064 if (isContextLost()) 1064 if (isContextLost())
1065 return; 1065 return;
1066 if (!pixels) { 1066 if (!pixels) {
1067 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "no image data"); 1067 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "no image data");
1068 return; 1068 return;
1069 } 1069 }
(...skipping 16 matching lines...) Expand all
1086 // No conversion is needed if destination format is RGBA and type is USIGNED _BYTE and no Flip or Premultiply operation is required. 1086 // No conversion is needed if destination format is RGBA and type is USIGNED _BYTE and no Flip or Premultiply operation is required.
1087 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE && !m_unpackFlipY && !m_un packPremultiplyAlpha) { 1087 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE && !m_unpackFlipY && !m_un packPremultiplyAlpha) {
1088 needConversion = false; 1088 needConversion = false;
1089 } else { 1089 } else {
1090 if (!WebGLImageConversion::extractImageData(pixels->data()->data(), pixe ls->size(), format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { 1090 if (!WebGLImageConversion::extractImageData(pixels->data()->data(), pixe ls->size(), format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
1091 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data "); 1091 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data ");
1092 return; 1092 return;
1093 } 1093 }
1094 } 1094 }
1095 resetUnpackParameters(); 1095 resetUnpackParameters();
1096 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, pixels ->width(), pixels->height(), 1, format, type, needConversion ? data.data() : pix els->data()->data()); 1096 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, pixels- >width(), pixels->height(), 1, format, type, needConversion ? data.data() : pixe ls->data()->data());
1097 restoreUnpackParameters(); 1097 restoreUnpackParameters();
1098 } 1098 }
1099 1099
1100 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle ment* image, ExceptionState& exceptionState) 1100 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle ment* image, ExceptionState& exceptionState)
1101 { 1101 {
1102 if (isContextLost()) 1102 if (isContextLost())
1103 return; 1103 return;
1104 if (!validateHTMLImageElement("texSubImage3D", image, exceptionState)) 1104 if (!validateHTMLImageElement("texSubImage3D", image, exceptionState))
1105 return; 1105 return;
1106 if (!validateTexture3DBinding("texSubImage3D", target)) 1106 if (!validateTexture3DBinding("texSubImage3D", target))
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { 1170 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
1171 needConversion = false; 1171 needConversion = false;
1172 } else { 1172 } else {
1173 // In the case of ImageBitmap, we do not need to apply flipY or premulti plyAlpha. 1173 // In the case of ImageBitmap, we do not need to apply flipY or premulti plyAlpha.
1174 if (!WebGLImageConversion::extractImageData(pixelData.get(), bitmap->siz e(), format, type, false, false, data)) { 1174 if (!WebGLImageConversion::extractImageData(pixelData.get(), bitmap->siz e(), format, type, false, false, data)) {
1175 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data "); 1175 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data ");
1176 return; 1176 return;
1177 } 1177 }
1178 } 1178 }
1179 resetUnpackParameters(); 1179 resetUnpackParameters();
1180 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, bitmap ->width(), bitmap->height(), 1, format, type, needConversion ? data.data() : pix elData.get()); 1180 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, bitmap- >width(), bitmap->height(), 1, format, type, needConversion ? data.data() : pixe lData.get());
1181 restoreUnpackParameters(); 1181 restoreUnpackParameters();
1182 } 1182 }
1183 1183
1184 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height) 1184 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height)
1185 { 1185 {
1186 if (isContextLost()) 1186 if (isContextLost())
1187 return; 1187 return;
1188 if (!validateTexture3DBinding("copyTexSubImage3D", target)) 1188 if (!validateTexture3DBinding("copyTexSubImage3D", target))
1189 return; 1189 return;
1190 WebGLFramebuffer* readFramebufferBinding = nullptr; 1190 WebGLFramebuffer* readFramebufferBinding = nullptr;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 void WebGL2RenderingContextBase::uniform1ui(const WebGLUniformLocation* location , GLuint v0) 1229 void WebGL2RenderingContextBase::uniform1ui(const WebGLUniformLocation* location , GLuint v0)
1230 { 1230 {
1231 if (isContextLost() || !location) 1231 if (isContextLost() || !location)
1232 return; 1232 return;
1233 1233
1234 if (location->program() != m_currentProgram) { 1234 if (location->program() != m_currentProgram) {
1235 synthesizeGLError(GL_INVALID_OPERATION, "uniform1ui", "location not for current program"); 1235 synthesizeGLError(GL_INVALID_OPERATION, "uniform1ui", "location not for current program");
1236 return; 1236 return;
1237 } 1237 }
1238 1238
1239 webContext()->uniform1ui(location->location(), v0); 1239 contextGL()->Uniform1ui(location->location(), v0);
1240 } 1240 }
1241 1241
1242 void WebGL2RenderingContextBase::uniform2ui(const WebGLUniformLocation* location , GLuint v0, GLuint v1) 1242 void WebGL2RenderingContextBase::uniform2ui(const WebGLUniformLocation* location , GLuint v0, GLuint v1)
1243 { 1243 {
1244 if (isContextLost() || !location) 1244 if (isContextLost() || !location)
1245 return; 1245 return;
1246 1246
1247 if (location->program() != m_currentProgram) { 1247 if (location->program() != m_currentProgram) {
1248 synthesizeGLError(GL_INVALID_OPERATION, "uniform2ui", "location not for current program"); 1248 synthesizeGLError(GL_INVALID_OPERATION, "uniform2ui", "location not for current program");
1249 return; 1249 return;
1250 } 1250 }
1251 1251
1252 webContext()->uniform2ui(location->location(), v0, v1); 1252 contextGL()->Uniform2ui(location->location(), v0, v1);
1253 } 1253 }
1254 1254
1255 void WebGL2RenderingContextBase::uniform3ui(const WebGLUniformLocation* location , GLuint v0, GLuint v1, GLuint v2) 1255 void WebGL2RenderingContextBase::uniform3ui(const WebGLUniformLocation* location , GLuint v0, GLuint v1, GLuint v2)
1256 { 1256 {
1257 if (isContextLost() || !location) 1257 if (isContextLost() || !location)
1258 return; 1258 return;
1259 1259
1260 if (location->program() != m_currentProgram) { 1260 if (location->program() != m_currentProgram) {
1261 synthesizeGLError(GL_INVALID_OPERATION, "uniform3ui", "location not for current program"); 1261 synthesizeGLError(GL_INVALID_OPERATION, "uniform3ui", "location not for current program");
1262 return; 1262 return;
1263 } 1263 }
1264 1264
1265 webContext()->uniform3ui(location->location(), v0, v1, v2); 1265 contextGL()->Uniform3ui(location->location(), v0, v1, v2);
1266 } 1266 }
1267 1267
1268 void WebGL2RenderingContextBase::uniform4ui(const WebGLUniformLocation* location , GLuint v0, GLuint v1, GLuint v2, GLuint v3) 1268 void WebGL2RenderingContextBase::uniform4ui(const WebGLUniformLocation* location , GLuint v0, GLuint v1, GLuint v2, GLuint v3)
1269 { 1269 {
1270 if (isContextLost() || !location) 1270 if (isContextLost() || !location)
1271 return; 1271 return;
1272 1272
1273 if (location->program() != m_currentProgram) { 1273 if (location->program() != m_currentProgram) {
1274 synthesizeGLError(GL_INVALID_OPERATION, "uniform4ui", "location not for current program"); 1274 synthesizeGLError(GL_INVALID_OPERATION, "uniform4ui", "location not for current program");
1275 return; 1275 return;
1276 } 1276 }
1277 1277
1278 webContext()->uniform4ui(location->location(), v0, v1, v2, v3); 1278 contextGL()->Uniform4ui(location->location(), v0, v1, v2, v3);
1279 } 1279 }
1280 1280
1281 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v) 1281 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
1282 { 1282 {
1283 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 1uiv", location, v, 1)) 1283 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 1uiv", location, v, 1))
1284 return; 1284 return;
1285 1285
1286 webContext()->uniform1uiv(location->location(), v.length(), v.dataMaybeOnSta ck()); 1286 contextGL()->Uniform1uiv(location->location(), v.length(), v.dataMaybeOnStac k());
1287 } 1287 }
1288 1288
1289 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 1289 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
1290 { 1290 {
1291 if (isContextLost() || !validateUniformParameters("uniform1uiv", location, v alue.data(), value.size(), 1)) 1291 if (isContextLost() || !validateUniformParameters("uniform1uiv", location, v alue.data(), value.size(), 1))
1292 return; 1292 return;
1293 1293
1294 webContext()->uniform1uiv(location->location(), value.size(), value.data()); 1294 contextGL()->Uniform1uiv(location->location(), value.size(), value.data());
1295 } 1295 }
1296 1296
1297 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v) 1297 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
1298 { 1298 {
1299 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 2uiv", location, v, 2)) 1299 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 2uiv", location, v, 2))
1300 return; 1300 return;
1301 1301
1302 webContext()->uniform2uiv(location->location(), v.length() >> 1, v.dataMaybe OnStack()); 1302 contextGL()->Uniform2uiv(location->location(), v.length() >> 1, v.dataMaybeO nStack());
1303 } 1303 }
1304 1304
1305 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 1305 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
1306 { 1306 {
1307 if (isContextLost() || !validateUniformParameters("uniform2uiv", location, v alue.data(), value.size(), 2)) 1307 if (isContextLost() || !validateUniformParameters("uniform2uiv", location, v alue.data(), value.size(), 2))
1308 return; 1308 return;
1309 1309
1310 webContext()->uniform2uiv(location->location(), value.size() / 2, value.data ()); 1310 contextGL()->Uniform2uiv(location->location(), value.size() / 2, value.data( ));
1311 } 1311 }
1312 1312
1313 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v) 1313 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
1314 { 1314 {
1315 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 3uiv", location, v, 3)) 1315 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 3uiv", location, v, 3))
1316 return; 1316 return;
1317 1317
1318 webContext()->uniform3uiv(location->location(), v.length() / 3, v.dataMaybeO nStack()); 1318 contextGL()->Uniform3uiv(location->location(), v.length() / 3, v.dataMaybeOn Stack());
1319 } 1319 }
1320 1320
1321 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 1321 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
1322 { 1322 {
1323 if (isContextLost() || !validateUniformParameters("uniform3uiv", location, v alue.data(), value.size(), 3)) 1323 if (isContextLost() || !validateUniformParameters("uniform3uiv", location, v alue.data(), value.size(), 3))
1324 return; 1324 return;
1325 1325
1326 webContext()->uniform3uiv(location->location(), value.size() / 3, value.data ()); 1326 contextGL()->Uniform3uiv(location->location(), value.size() / 3, value.data( ));
1327 } 1327 }
1328 1328
1329 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v) 1329 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
1330 { 1330 {
1331 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 4uiv", location, v, 4)) 1331 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 4uiv", location, v, 4))
1332 return; 1332 return;
1333 1333
1334 webContext()->uniform4uiv(location->location(), v.length() >> 2, v.dataMaybe OnStack()); 1334 contextGL()->Uniform4uiv(location->location(), v.length() >> 2, v.dataMaybeO nStack());
1335 } 1335 }
1336 1336
1337 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 1337 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
1338 { 1338 {
1339 if (isContextLost() || !validateUniformParameters("uniform4uiv", location, v alue.data(), value.size(), 4)) 1339 if (isContextLost() || !validateUniformParameters("uniform4uiv", location, v alue.data(), value.size(), 4))
1340 return; 1340 return;
1341 1341
1342 webContext()->uniform4uiv(location->location(), value.size() / 4, value.data ()); 1342 contextGL()->Uniform4uiv(location->location(), value.size() / 4, value.data( ));
1343 } 1343 }
1344 1344
1345 void WebGL2RenderingContextBase::uniformMatrix2x3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 1345 void WebGL2RenderingContextBase::uniformMatrix2x3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
1346 { 1346 {
1347 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x3fv" , location, transpose, value, 6)) 1347 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x3fv" , location, transpose, value, 6))
1348 return; 1348 return;
1349 webContext()->uniformMatrix2x3fv(location->location(), value->length() / 6, transpose, value->data()); 1349 contextGL()->UniformMatrix2x3fv(location->location(), value->length() / 6, t ranspose, value->data());
1350 } 1350 }
1351 1351
1352 void WebGL2RenderingContextBase::uniformMatrix2x3fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value) 1352 void WebGL2RenderingContextBase::uniformMatrix2x3fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value)
1353 { 1353 {
1354 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x3fv" , location, transpose, value.data(), value.size(), 6)) 1354 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x3fv" , location, transpose, value.data(), value.size(), 6))
1355 return; 1355 return;
1356 webContext()->uniformMatrix2x3fv(location->location(), value.size() / 6, tra nspose, value.data()); 1356 contextGL()->UniformMatrix2x3fv(location->location(), value.size() / 6, tran spose, value.data());
1357 } 1357 }
1358 1358
1359 void WebGL2RenderingContextBase::uniformMatrix3x2fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 1359 void WebGL2RenderingContextBase::uniformMatrix3x2fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
1360 { 1360 {
1361 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x2fv" , location, transpose, value, 6)) 1361 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x2fv" , location, transpose, value, 6))
1362 return; 1362 return;
1363 webContext()->uniformMatrix3x2fv(location->location(), value->length() / 6, transpose, value->data()); 1363 contextGL()->UniformMatrix3x2fv(location->location(), value->length() / 6, t ranspose, value->data());
1364 } 1364 }
1365 1365
1366 void WebGL2RenderingContextBase::uniformMatrix3x2fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value) 1366 void WebGL2RenderingContextBase::uniformMatrix3x2fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value)
1367 { 1367 {
1368 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x2fv" , location, transpose, value.data(), value.size(), 6)) 1368 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x2fv" , location, transpose, value.data(), value.size(), 6))
1369 return; 1369 return;
1370 webContext()->uniformMatrix3x2fv(location->location(), value.size() / 6, tra nspose, value.data()); 1370 contextGL()->UniformMatrix3x2fv(location->location(), value.size() / 6, tran spose, value.data());
1371 } 1371 }
1372 1372
1373 void WebGL2RenderingContextBase::uniformMatrix2x4fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 1373 void WebGL2RenderingContextBase::uniformMatrix2x4fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
1374 { 1374 {
1375 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x4fv" , location, transpose, value, 8)) 1375 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x4fv" , location, transpose, value, 8))
1376 return; 1376 return;
1377 webContext()->uniformMatrix2x4fv(location->location(), value->length() / 8, transpose, value->data()); 1377 contextGL()->UniformMatrix2x4fv(location->location(), value->length() / 8, t ranspose, value->data());
1378 } 1378 }
1379 1379
1380 void WebGL2RenderingContextBase::uniformMatrix2x4fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value) 1380 void WebGL2RenderingContextBase::uniformMatrix2x4fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value)
1381 { 1381 {
1382 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x4fv" , location, transpose, value.data(), value.size(), 8)) 1382 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x4fv" , location, transpose, value.data(), value.size(), 8))
1383 return; 1383 return;
1384 webContext()->uniformMatrix2x4fv(location->location(), value.size() / 8, tra nspose, value.data()); 1384 contextGL()->UniformMatrix2x4fv(location->location(), value.size() / 8, tran spose, value.data());
1385 } 1385 }
1386 1386
1387 void WebGL2RenderingContextBase::uniformMatrix4x2fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 1387 void WebGL2RenderingContextBase::uniformMatrix4x2fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
1388 { 1388 {
1389 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x2fv" , location, transpose, value, 8)) 1389 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x2fv" , location, transpose, value, 8))
1390 return; 1390 return;
1391 webContext()->uniformMatrix4x2fv(location->location(), value->length() / 8, transpose, value->data()); 1391 contextGL()->UniformMatrix4x2fv(location->location(), value->length() / 8, t ranspose, value->data());
1392 } 1392 }
1393 1393
1394 void WebGL2RenderingContextBase::uniformMatrix4x2fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value) 1394 void WebGL2RenderingContextBase::uniformMatrix4x2fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value)
1395 { 1395 {
1396 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x2fv" , location, transpose, value.data(), value.size(), 8)) 1396 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x2fv" , location, transpose, value.data(), value.size(), 8))
1397 return; 1397 return;
1398 webContext()->uniformMatrix4x2fv(location->location(), value.size() / 8, tra nspose, value.data()); 1398 contextGL()->UniformMatrix4x2fv(location->location(), value.size() / 8, tran spose, value.data());
1399 } 1399 }
1400 1400
1401 void WebGL2RenderingContextBase::uniformMatrix3x4fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 1401 void WebGL2RenderingContextBase::uniformMatrix3x4fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
1402 { 1402 {
1403 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x4fv" , location, transpose, value, 12)) 1403 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x4fv" , location, transpose, value, 12))
1404 return; 1404 return;
1405 webContext()->uniformMatrix3x4fv(location->location(), value->length() / 12, transpose, value->data()); 1405 contextGL()->UniformMatrix3x4fv(location->location(), value->length() / 12, transpose, value->data());
1406 } 1406 }
1407 1407
1408 void WebGL2RenderingContextBase::uniformMatrix3x4fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value) 1408 void WebGL2RenderingContextBase::uniformMatrix3x4fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value)
1409 { 1409 {
1410 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x4fv" , location, transpose, value.data(), value.size(), 12)) 1410 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x4fv" , location, transpose, value.data(), value.size(), 12))
1411 return; 1411 return;
1412 webContext()->uniformMatrix3x4fv(location->location(), value.size() / 12, tr anspose, value.data()); 1412 contextGL()->UniformMatrix3x4fv(location->location(), value.size() / 12, tra nspose, value.data());
1413 } 1413 }
1414 1414
1415 void WebGL2RenderingContextBase::uniformMatrix4x3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 1415 void WebGL2RenderingContextBase::uniformMatrix4x3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
1416 { 1416 {
1417 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x3fv" , location, transpose, value, 12)) 1417 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x3fv" , location, transpose, value, 12))
1418 return; 1418 return;
1419 webContext()->uniformMatrix4x3fv(location->location(), value->length() / 12, transpose, value->data()); 1419 contextGL()->UniformMatrix4x3fv(location->location(), value->length() / 12, transpose, value->data());
1420 } 1420 }
1421 1421
1422 void WebGL2RenderingContextBase::uniformMatrix4x3fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value) 1422 void WebGL2RenderingContextBase::uniformMatrix4x3fv(const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& value)
1423 { 1423 {
1424 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x3fv" , location, transpose, value.data(), value.size(), 12)) 1424 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x3fv" , location, transpose, value.data(), value.size(), 12))
1425 return; 1425 return;
1426 webContext()->uniformMatrix4x3fv(location->location(), value.size() / 12, tr anspose, value.data()); 1426 contextGL()->UniformMatrix4x3fv(location->location(), value.size() / 12, tra nspose, value.data());
1427 } 1427 }
1428 1428
1429 void WebGL2RenderingContextBase::vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) 1429 void WebGL2RenderingContextBase::vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
1430 { 1430 {
1431 if (isContextLost()) 1431 if (isContextLost())
1432 return; 1432 return;
1433 webContext()->vertexAttribI4i(index, x, y, z, w); 1433 contextGL()->VertexAttribI4i(index, x, y, z, w);
1434 setVertexAttribType(index, Int32ArrayType); 1434 setVertexAttribType(index, Int32ArrayType);
1435 } 1435 }
1436 1436
1437 void WebGL2RenderingContextBase::vertexAttribI4iv(GLuint index, const DOMInt32Ar ray* v) 1437 void WebGL2RenderingContextBase::vertexAttribI4iv(GLuint index, const DOMInt32Ar ray* v)
1438 { 1438 {
1439 if (isContextLost()) 1439 if (isContextLost())
1440 return; 1440 return;
1441 if (!v || v->length() < 4) { 1441 if (!v || v->length() < 4) {
1442 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4iv", "invalid array") ; 1442 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4iv", "invalid array") ;
1443 return; 1443 return;
1444 } 1444 }
1445 webContext()->vertexAttribI4iv(index, v->data()); 1445 contextGL()->VertexAttribI4iv(index, v->data());
1446 setVertexAttribType(index, Int32ArrayType); 1446 setVertexAttribType(index, Int32ArrayType);
1447 } 1447 }
1448 1448
1449 void WebGL2RenderingContextBase::vertexAttribI4iv(GLuint index, const Vector<GLi nt>& v) 1449 void WebGL2RenderingContextBase::vertexAttribI4iv(GLuint index, const Vector<GLi nt>& v)
1450 { 1450 {
1451 if (isContextLost()) 1451 if (isContextLost())
1452 return; 1452 return;
1453 if (v.size() < 4) { 1453 if (v.size() < 4) {
1454 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4iv", "invalid array") ; 1454 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4iv", "invalid array") ;
1455 return; 1455 return;
1456 } 1456 }
1457 webContext()->vertexAttribI4iv(index, v.data()); 1457 contextGL()->VertexAttribI4iv(index, v.data());
1458 setVertexAttribType(index, Int32ArrayType); 1458 setVertexAttribType(index, Int32ArrayType);
1459 } 1459 }
1460 1460
1461 void WebGL2RenderingContextBase::vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) 1461 void WebGL2RenderingContextBase::vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
1462 { 1462 {
1463 if (isContextLost()) 1463 if (isContextLost())
1464 return; 1464 return;
1465 webContext()->vertexAttribI4ui(index, x, y, z, w); 1465 contextGL()->VertexAttribI4ui(index, x, y, z, w);
1466 setVertexAttribType(index, Uint32ArrayType); 1466 setVertexAttribType(index, Uint32ArrayType);
1467 } 1467 }
1468 1468
1469 void WebGL2RenderingContextBase::vertexAttribI4uiv(GLuint index, const DOMUint32 Array* v) 1469 void WebGL2RenderingContextBase::vertexAttribI4uiv(GLuint index, const DOMUint32 Array* v)
1470 { 1470 {
1471 if (isContextLost()) 1471 if (isContextLost())
1472 return; 1472 return;
1473 if (!v || v->length() < 4) { 1473 if (!v || v->length() < 4) {
1474 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4uiv", "invalid array" ); 1474 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4uiv", "invalid array" );
1475 return; 1475 return;
1476 } 1476 }
1477 webContext()->vertexAttribI4uiv(index, v->data()); 1477 contextGL()->VertexAttribI4uiv(index, v->data());
1478 setVertexAttribType(index, Uint32ArrayType); 1478 setVertexAttribType(index, Uint32ArrayType);
1479 } 1479 }
1480 1480
1481 void WebGL2RenderingContextBase::vertexAttribI4uiv(GLuint index, const Vector<GL uint>& v) 1481 void WebGL2RenderingContextBase::vertexAttribI4uiv(GLuint index, const Vector<GL uint>& v)
1482 { 1482 {
1483 if (isContextLost()) 1483 if (isContextLost())
1484 return; 1484 return;
1485 if (v.size() < 4) { 1485 if (v.size() < 4) {
1486 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4uiv", "invalid array" ); 1486 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribI4uiv", "invalid array" );
1487 return; 1487 return;
1488 } 1488 }
1489 webContext()->vertexAttribI4uiv(index, v.data()); 1489 contextGL()->VertexAttribI4uiv(index, v.data());
1490 setVertexAttribType(index, Uint32ArrayType); 1490 setVertexAttribType(index, Uint32ArrayType);
1491 } 1491 }
1492 1492
1493 void WebGL2RenderingContextBase::vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, long long offset) 1493 void WebGL2RenderingContextBase::vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, long long offset)
1494 { 1494 {
1495 if (isContextLost()) 1495 if (isContextLost())
1496 return; 1496 return;
1497 if (index >= m_maxVertexAttribs) { 1497 if (index >= m_maxVertexAttribs) {
1498 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribIPointer", "index out o f range"); 1498 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribIPointer", "index out o f range");
1499 return; 1499 return;
(...skipping 13 matching lines...) Expand all
1513 void WebGL2RenderingContextBase::vertexAttribDivisor(GLuint index, GLuint diviso r) 1513 void WebGL2RenderingContextBase::vertexAttribDivisor(GLuint index, GLuint diviso r)
1514 { 1514 {
1515 if (isContextLost()) 1515 if (isContextLost())
1516 return; 1516 return;
1517 1517
1518 if (index >= m_maxVertexAttribs) { 1518 if (index >= m_maxVertexAttribs) {
1519 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribDivisor", "index out of range"); 1519 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribDivisor", "index out of range");
1520 return; 1520 return;
1521 } 1521 }
1522 1522
1523 webContext()->vertexAttribDivisorANGLE(index, divisor); 1523 contextGL()->VertexAttribDivisorANGLE(index, divisor);
1524 } 1524 }
1525 1525
1526 void WebGL2RenderingContextBase::drawArraysInstanced(GLenum mode, GLint first, G Lsizei count, GLsizei instanceCount) 1526 void WebGL2RenderingContextBase::drawArraysInstanced(GLenum mode, GLint first, G Lsizei count, GLsizei instanceCount)
1527 { 1527 {
1528 if (!validateDrawArrays("drawArraysInstanced")) 1528 if (!validateDrawArrays("drawArraysInstanced"))
1529 return; 1529 return;
1530 1530
1531 clearIfComposited(); 1531 clearIfComposited();
1532 webContext()->drawArraysInstancedANGLE(mode, first, count, instanceCount); 1532 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount);
1533 markContextChanged(CanvasChanged); 1533 markContextChanged(CanvasChanged);
1534 } 1534 }
1535 1535
1536 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, GLsizei coun t, GLenum type, long long offset, GLsizei instanceCount) 1536 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, GLsizei coun t, GLenum type, long long offset, GLsizei instanceCount)
1537 { 1537 {
1538 if (!validateDrawElements("drawElementsInstanced", type, offset)) 1538 if (!validateDrawElements("drawElementsInstanced", type, offset))
1539 return; 1539 return;
1540 1540
1541 if (transformFeedbackActive() && !transformFeedbackPaused()) { 1541 if (transformFeedbackActive() && !transformFeedbackPaused()) {
1542 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "transf orm feedback is active and not paused"); 1542 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "transf orm feedback is active and not paused");
1543 return; 1543 return;
1544 } 1544 }
1545 1545
1546 clearIfComposited(); 1546 clearIfComposited();
1547 webContext()->drawElementsInstancedANGLE(mode, count, type, static_cast<GLin tptr>(offset), instanceCount); 1547 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast< void*>(static_cast<intptr_t>(offset)), instanceCount);
1548 markContextChanged(CanvasChanged); 1548 markContextChanged(CanvasChanged);
1549 } 1549 }
1550 1550
1551 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, GLuint start, GL uint end, GLsizei count, GLenum type, long long offset) 1551 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, GLuint start, GL uint end, GLsizei count, GLenum type, long long offset)
1552 { 1552 {
1553 if (!validateDrawElements("drawRangeElements", type, offset)) 1553 if (!validateDrawElements("drawRangeElements", type, offset))
1554 return; 1554 return;
1555 1555
1556 if (transformFeedbackActive() && !transformFeedbackPaused()) { 1556 if (transformFeedbackActive() && !transformFeedbackPaused()) {
1557 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "transform feedback is active and not paused"); 1557 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "transform feedback is active and not paused");
(...skipping 30 matching lines...) Expand all
1588 if (n != 1) { 1588 if (n != 1) {
1589 synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "the number o f buffers is not 1"); 1589 synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "the number o f buffers is not 1");
1590 return; 1590 return;
1591 } 1591 }
1592 if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) { 1592 if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) {
1593 synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "BACK or NONE "); 1593 synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "BACK or NONE ");
1594 return; 1594 return;
1595 } 1595 }
1596 // Because the backbuffer is simulated on all current WebKit ports, we n eed to change BACK to COLOR_ATTACHMENT0. 1596 // Because the backbuffer is simulated on all current WebKit ports, we n eed to change BACK to COLOR_ATTACHMENT0.
1597 GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; 1597 GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE;
1598 webContext()->drawBuffersEXT(1, &value); 1598 contextGL()->DrawBuffersEXT(1, &value);
1599 setBackDrawBuffer(bufs[0]); 1599 setBackDrawBuffer(bufs[0]);
1600 } else { 1600 } else {
1601 if (n > maxDrawBuffers()) { 1601 if (n > maxDrawBuffers()) {
1602 synthesizeGLError(GL_INVALID_VALUE, "drawBuffers", "more than max dr aw buffers"); 1602 synthesizeGLError(GL_INVALID_VALUE, "drawBuffers", "more than max dr aw buffers");
1603 return; 1603 return;
1604 } 1604 }
1605 for (GLsizei i = 0; i < n; ++i) { 1605 for (GLsizei i = 0; i < n; ++i) {
1606 if (bufs[i] != GL_NONE && bufs[i] != static_cast<GLenum>(GL_COLOR_AT TACHMENT0_EXT + i)) { 1606 if (bufs[i] != GL_NONE && bufs[i] != static_cast<GLenum>(GL_COLOR_AT TACHMENT0_EXT + i)) {
1607 synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "COLOR_AT TACHMENTi_EXT or NONE"); 1607 synthesizeGLError(GL_INVALID_OPERATION, "drawBuffers", "COLOR_AT TACHMENTi_EXT or NONE");
1608 return; 1608 return;
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 } 2643 }
2644 2644
2645 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui nt uniformBlockIndex, GLuint uniformBlockBinding) 2645 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui nt uniformBlockIndex, GLuint uniformBlockBinding)
2646 { 2646 {
2647 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) 2647 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program))
2648 return; 2648 return;
2649 2649
2650 if (!validateUniformBlockIndex("uniformBlockBinding", program, uniformBlockI ndex)) 2650 if (!validateUniformBlockIndex("uniformBlockBinding", program, uniformBlockI ndex))
2651 return; 2651 return;
2652 2652
2653 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex, uniformBlockBinding); 2653 contextGL()->UniformBlockBinding(objectOrZero(program), uniformBlockIndex, u niformBlockBinding);
2654 } 2654 }
2655 2655
2656 WebGLVertexArrayObject* WebGL2RenderingContextBase::createVertexArray() 2656 WebGLVertexArrayObject* WebGL2RenderingContextBase::createVertexArray()
2657 { 2657 {
2658 if (isContextLost()) 2658 if (isContextLost())
2659 return nullptr; 2659 return nullptr;
2660 2660
2661 WebGLVertexArrayObject* o = WebGLVertexArrayObject::create(this, WebGLVertex ArrayObjectBase::VaoTypeUser); 2661 WebGLVertexArrayObject* o = WebGLVertexArrayObject::create(this, WebGLVertex ArrayObjectBase::VaoTypeUser);
2662 addContextObject(o); 2662 addContextObject(o);
2663 return o; 2663 return o;
2664 } 2664 }
2665 2665
2666 void WebGL2RenderingContextBase::deleteVertexArray(ScriptState* scriptState, Web GLVertexArrayObject* vertexArray) 2666 void WebGL2RenderingContextBase::deleteVertexArray(ScriptState* scriptState, Web GLVertexArrayObject* vertexArray)
2667 { 2667 {
2668 if (isContextLost() || !vertexArray) 2668 if (isContextLost() || !vertexArray)
2669 return; 2669 return;
2670 2670
2671 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje ct) 2671 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje ct)
2672 setBoundVertexArrayObject(scriptState, nullptr); 2672 setBoundVertexArrayObject(scriptState, nullptr);
2673 2673
2674 vertexArray->deleteObject(webContext()); 2674 vertexArray->deleteObject(webContext(), contextGL());
2675 } 2675 }
2676 2676
2677 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObject* vert exArray) 2677 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObject* vert exArray)
2678 { 2678 {
2679 if (isContextLost() || !vertexArray) 2679 if (isContextLost() || !vertexArray)
2680 return 0; 2680 return 0;
2681 2681
2682 if (!vertexArray->hasEverBeenBound()) 2682 if (!vertexArray->hasEverBeenBound())
2683 return 0; 2683 return 0;
2684 2684
2685 return webContext()->isVertexArrayOES(vertexArray->object()); 2685 return contextGL()->IsVertexArrayOES(vertexArray->object());
2686 } 2686 }
2687 2687
2688 void WebGL2RenderingContextBase::bindVertexArray(ScriptState* scriptState, WebGL VertexArrayObject* vertexArray) 2688 void WebGL2RenderingContextBase::bindVertexArray(ScriptState* scriptState, WebGL VertexArrayObject* vertexArray)
2689 { 2689 {
2690 if (isContextLost()) 2690 if (isContextLost())
2691 return; 2691 return;
2692 2692
2693 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th is))) { 2693 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th is))) {
2694 webContext()->synthesizeGLError(GL_INVALID_OPERATION); 2694 webContext()->synthesizeGLError(GL_INVALID_OPERATION);
2695 return; 2695 return;
2696 } 2696 }
2697 2697
2698 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object()) { 2698 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object()) {
2699 webContext()->bindVertexArrayOES(objectOrZero(vertexArray)); 2699 contextGL()->BindVertexArrayOES(objectOrZero(vertexArray));
2700 2700
2701 vertexArray->setHasEverBeenBound(); 2701 vertexArray->setHasEverBeenBound();
2702 setBoundVertexArrayObject(scriptState, vertexArray); 2702 setBoundVertexArrayObject(scriptState, vertexArray);
2703 } else { 2703 } else {
2704 webContext()->bindVertexArrayOES(0); 2704 contextGL()->BindVertexArrayOES(0);
2705 setBoundVertexArrayObject(scriptState, nullptr); 2705 setBoundVertexArrayObject(scriptState, nullptr);
2706 } 2706 }
2707 } 2707 }
2708 2708
2709 void WebGL2RenderingContextBase::bindFramebuffer(ScriptState* scriptState, GLenu m target, WebGLFramebuffer* buffer) 2709 void WebGL2RenderingContextBase::bindFramebuffer(ScriptState* scriptState, GLenu m target, WebGLFramebuffer* buffer)
2710 { 2710 {
2711 bool deleted; 2711 bool deleted;
2712 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) 2712 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted))
2713 return; 2713 return;
2714 2714
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 params.skipPixels = m_unpackSkipPixels; 3592 params.skipPixels = m_unpackSkipPixels;
3593 params.skipRows = m_unpackSkipRows; 3593 params.skipRows = m_unpackSkipRows;
3594 if (dimension == Tex3D) { 3594 if (dimension == Tex3D) {
3595 params.imageHeight = m_unpackImageHeight; 3595 params.imageHeight = m_unpackImageHeight;
3596 params.skipImages = m_unpackSkipImages; 3596 params.skipImages = m_unpackSkipImages;
3597 } 3597 }
3598 return params; 3598 return params;
3599 } 3599 }
3600 3600
3601 } // namespace blink 3601 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698