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

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

Issue 2025703002: Pack repeated code in tex(Sub)Image2D and texSubImage3D into helper func (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a default case to prevent compile error Created 4 years, 6 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth) 938 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth)
939 { 939 {
940 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D)) 940 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D))
941 return; 941 return;
942 942
943 contextGL()->TexStorage3D(target, levels, internalformat, width, height, dep th); 943 contextGL()->TexStorage3D(target, levels, internalformat, width, height, dep th);
944 } 944 }
945 945
946 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels) 946 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels)
947 { 947 {
948 if (isContextLost()) 948 texImageHelperDOMArrayBufferView(TexImage3D, target, level, internalformat, width, height, border, format, type, depth, 0, 0, 0, pixels);
949 return;
950 if (!validateTexture3DBinding("texImage3D", target))
951 return;
952 if (!validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, target, level, internalformat, width, height, depth, border, format, type, 0, 0, 0))
953 return;
954 if (!validateTexFuncData("texImage3D", Tex3D, level, width, height, depth, f ormat, type, pixels, NullAllowed))
955 return;
956
957 void* data = pixels ? pixels->baseAddress() : 0;
958 Vector<uint8_t> tempData;
959 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
960 // FIXME: WebGLImageConversion needs to be updated to accept image depth .
961 NOTIMPLEMENTED();
962 return;
963 }
964
965 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform at, type), width, height, depth, border, format, type, data);
966 } 949 }
967 950
968 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr offset) 951 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr offset)
969 { 952 {
970 if (isContextLost()) 953 if (isContextLost())
971 return; 954 return;
972 if (!validateTexture3DBinding("texImage3D", target)) 955 if (!validateTexture3DBinding("texImage3D", target))
973 return; 956 return;
974 if (!m_boundPixelUnpackBuffer) { 957 if (!m_boundPixelUnpackBuffer) {
975 synthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "no bound PIXEL_UN PACK_BUFFER"); 958 synthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "no bound PIXEL_UN PACK_BUFFER");
976 return; 959 return;
977 } 960 }
978 if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, lev el, internalformat, width, height, depth, border, format, type, 0, 0, 0)) 961 if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, lev el, internalformat, width, height, depth, border, format, type, 0, 0, 0))
979 return; 962 return;
980 if (!validateValueFitNonNegInt32("texImage3D", "offset", offset)) 963 if (!validateValueFitNonNegInt32("texImage3D", "offset", offset))
981 return; 964 return;
982 965
983 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform at, type), width, height, depth, border, format, type, reinterpret_cast<const vo id *>(offset)); 966 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform at, type), width, height, depth, border, format, type, reinterpret_cast<const vo id *>(offset));
984 } 967 }
985 968
986 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)
987 {
988 // All calling functions check isContextLost, so a duplicate check is not ne eded here.
989 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) {
990 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
991 type = GL_FLOAT;
992 }
993 Vector<uint8_t> data;
994 WebGLImageConversion::ImageExtractor imageExtractor(image, domSource, premul tiplyAlpha, m_unpackColorspaceConversion == GL_NONE);
995 if (!imageExtractor.imagePixelData()) {
996 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image");
997 return;
998 }
999 WebGLImageConversion::DataFormat sourceDataFormat = imageExtractor.imageSour ceFormat();
1000 WebGLImageConversion::AlphaOp alphaOp = imageExtractor.imageAlphaOp();
1001 const void* imagePixelData = imageExtractor.imagePixelData();
1002
1003 bool needConversion = true;
1004 if (type == GL_UNSIGNED_BYTE && sourceDataFormat == WebGLImageConversion::Da taFormatRGBA8 && format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNo thing && !flipY) {
1005 needConversion = false;
1006 } else {
1007 if (!WebGLImageConversion::packImageData(image, imagePixelData, format, type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtrac tor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) {
1008 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data ");
1009 return;
1010 }
1011 }
1012
1013 resetUnpackParameters();
1014 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, imageEx tractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConvers ion ? data.data() : imagePixelData);
1015 restoreUnpackParameters();
1016 }
1017
1018 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) 969 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)
1019 { 970 {
1020 if (isContextLost()) 971 texImageHelperDOMArrayBufferView(TexSubImage3D, target, level, 0, width, hei ght, 0, format, type, depth, xoffset, yoffset, zoffset, pixels);
1021 return;
1022 if (!validateTexture3DBinding("texSubImage3D", target))
1023 return;
1024 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceArrayBufferView, ta rget, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset ))
1025 return;
1026 if (!validateTexFuncData("texSubImage3D", Tex3D, level, width, height, depth , format, type, pixels, NullNotAllowed))
1027 return;
1028
1029 void* data = pixels->baseAddress();
1030 Vector<uint8_t> tempData;
1031 bool changeUnpackParameters = false;
1032 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
1033 // FIXME: WebGLImageConversion needs to be updated to accept image depth .
1034 NOTIMPLEMENTED();
1035 changeUnpackParameters = true;
1036 }
1037 if (changeUnpackParameters)
1038 resetUnpackParameters();
1039 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
1040 if (changeUnpackParameters)
1041 restoreUnpackParameters();
1042 } 972 }
1043 973
1044 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) 974 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)
1045 { 975 {
1046 if (isContextLost()) 976 if (isContextLost())
1047 return; 977 return;
1048 if (!validateTexture3DBinding("texSubImage3D", target)) 978 if (!validateTexture3DBinding("texSubImage3D", target))
1049 return; 979 return;
1050 if (!m_boundPixelUnpackBuffer) { 980 if (!m_boundPixelUnpackBuffer) {
1051 synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL _UNPACK_BUFFER"); 981 synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL _UNPACK_BUFFER");
1052 return; 982 return;
1053 } 983 }
1054 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) 984 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset))
1055 return; 985 return;
1056 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) 986 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset))
1057 return; 987 return;
1058 988
1059 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, reinterpret_cast<const void*>(offset)); 989 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, reinterpret_cast<const void*>(offset));
1060 } 990 }
1061 991
1062 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p ixels) 992 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p ixels)
1063 { 993 {
1064 if (isContextLost()) 994 texImageHelperImageData(TexSubImage3D, target, level, 0, 0, format, type, 1, xoffset, yoffset, zoffset, pixels);
1065 return;
1066 if (!pixels) {
1067 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "no image data");
1068 return;
1069 }
1070 if (pixels->data()->bufferBase()->isNeutered()) {
1071 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "The source data ha s been neutered.");
1072 return;
1073 }
1074 if (!validateTexture3DBinding("texSubImage3D", target))
1075 return;
1076 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceImageData, target, level, 0, pixels->width(), pixels->height(), 1, 0, format, type, xoffset, yoffse t, zoffset))
1077 return;
1078
1079 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) {
1080 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
1081 type = GL_FLOAT;
1082 }
1083 Vector<uint8_t> data;
1084 bool needConversion = true;
1085 // The data from ImageData is always of format RGBA8.
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) {
1088 needConversion = false;
1089 } else {
1090 if (!WebGLImageConversion::extractImageData(pixels->data()->data(), WebG LImageConversion::DataFormat::DataFormatRGBA8, pixels->size(), format, type, m_u npackFlipY, m_unpackPremultiplyAlpha, data)) {
1091 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data ");
1092 return;
1093 }
1094 }
1095 resetUnpackParameters();
1096 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, pixels- >width(), pixels->height(), 1, format, type, needConversion ? data.data() : pixe ls->data()->data());
1097 restoreUnpackParameters();
1098 } 995 }
1099 996
1100 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle ment* image, ExceptionState& exceptionState) 997 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle ment* image, ExceptionState& exceptionState)
1101 { 998 {
1102 if (isContextLost()) 999 texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type , xoffset, yoffset, zoffset, image, exceptionState);
1103 return;
1104 if (!validateHTMLImageElement("texSubImage3D", image, exceptionState))
1105 return;
1106 if (!validateTexture3DBinding("texSubImage3D", target))
1107 return;
1108
1109 RefPtr<Image> imageForRender = image->cachedImage()->getImage();
1110 if (imageForRender->isSVGImage())
1111 imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width( ), image->height(), "texSubImage3D");
1112
1113 if (!imageForRender || !validateTexFunc("texSubImage3D", TexSubImage, Source HTMLImageElement, target, level, 0, imageForRender->width(), imageForRender->hei ght(), 1, 0, format, type, xoffset, yoffset, zoffset))
1114 return;
1115
1116 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im ageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackP remultiplyAlpha);
1117 } 1000 }
1118 1001
1119 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) 1002 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState)
1120 { 1003 {
1121 if (isContextLost()) 1004 texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, typ e, xoffset, yoffset, zoffset, canvas, exceptionState);
1122 return;
1123 if (!validateHTMLCanvasElement("texSubImage3D", canvas, exceptionState))
1124 return;
1125 if (!validateTexture3DBinding("texSubImage3D", target))
1126 return;
1127 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLCanvasElement, target, level, 0, canvas->width(), canvas->height(), 1, 0, format, type, xoffset , yoffset, zoffset))
1128 return;
1129
1130 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269).
1131 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, ca nvas->copiedImage(FrontBuffer, PreferAcceleration).get(),
1132 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyA lpha);
1133 } 1005 }
1134 1006
1135 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) 1007 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState)
1136 { 1008 {
1137 if (isContextLost()) 1009 texImageHelperHTMLVideoElement(TexSubImage3D, target, level, 0, format, type , xoffset, yoffset, zoffset, video, exceptionState);
1138 return;
1139 if (!validateHTMLVideoElement("texSubImage3D", video, exceptionState))
1140 return;
1141 if (!validateTexture3DBinding("texSubImage3D", target))
1142 return;
1143 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLVideoElement, t arget, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, type, xoffset, yoffset, zoffset))
1144 return;
1145
1146 RefPtr<Image> image = videoFrameToImage(video);
1147 if (!image)
1148 return;
1149 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im age.get(), WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultipl yAlpha);
1150 } 1010 }
1151 1011
1152 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageBitmap* bitmap, ExceptionState& exceptionState) 1012 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageBitmap* bitmap, ExceptionState& exceptionState)
1153 { 1013 {
1154 if (isContextLost()) 1014 texImageHelperImageBitmap(TexSubImage3D, target, level, 0, format, type, xof fset, yoffset, zoffset, bitmap, exceptionState);
1155 return;
1156 if (!validateImageBitmap("texSubImage3D", bitmap, exceptionState))
1157 return;
1158 if (!validateTexture3DBinding("texSubImage3D", target))
1159 return;
1160 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceImageBitmap, target , level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, xoffset, yoff set, zoffset))
1161 return;
1162 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) {
1163 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
1164 type = GL_FLOAT;
1165 }
1166 ASSERT(bitmap->bitmapImage());
1167 RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame();
1168 SkPixmap pixmap;
1169 OwnPtr<uint8_t[]> pixelData;
1170 uint8_t* pixelDataPtr = nullptr;
1171 bool peekSucceed = skImage->peekPixels(&pixmap);
1172 if (peekSucceed) {
1173 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr());
1174 } else if (skImage->isTextureBacked()) {
1175 pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? Premultip lyAlpha : DontPremultiplyAlpha);
1176 pixelDataPtr = pixelData.get();
1177 }
1178 Vector<uint8_t> data;
1179 bool needConversion = true;
1180 bool havePeekableRGBA = (peekSucceed && pixmap.colorType() == SkColorType::k RGBA_8888_SkColorType);
1181 bool isPixelDataRBGA = (havePeekableRGBA || !peekSucceed);
1182 if (isPixelDataRBGA && format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
1183 needConversion = false;
1184 } else {
1185 // In the case of ImageBitmap, we do not need to apply flipY or premulti plyAlpha.
1186 bool isPixelDataBGRA = (peekSucceed && pixmap.colorType() == SkColorType ::kBGRA_8888_SkColorType);
1187 if ((isPixelDataBGRA && !WebGLImageConversion::extractImageData(pixelDat aPtr, WebGLImageConversion::DataFormat::DataFormatBGRA8, bitmap->size(), format, type, false, false, data))
1188 || (isPixelDataRBGA && !WebGLImageConversion::extractImageData(pixel DataPtr, WebGLImageConversion::DataFormat::DataFormatRGBA8, bitmap->size(), form at, type, false, false, data))) {
1189 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data ");
1190 return;
1191 }
1192 }
1193 resetUnpackParameters();
1194 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, bitmap- >width(), bitmap->height(), 1, format, type, needConversion ? data.data() : pixe lDataPtr);
1195 restoreUnpackParameters();
1196 } 1015 }
1197 1016
1198 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height) 1017 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height)
1199 { 1018 {
1200 if (isContextLost()) 1019 if (isContextLost())
1201 return; 1020 return;
1202 if (!validateTexture3DBinding("copyTexSubImage3D", target)) 1021 if (!validateTexture3DBinding("copyTexSubImage3D", target))
1203 return; 1022 return;
1204 WebGLFramebuffer* readFramebufferBinding = nullptr; 1023 WebGLFramebuffer* readFramebufferBinding = nullptr;
1205 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin g)) 1024 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin g))
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 return false; 1480 return false;
1662 } 1481 }
1663 break; 1482 break;
1664 default: 1483 default:
1665 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid buffer"); 1484 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid buffer");
1666 return false; 1485 return false;
1667 } 1486 }
1668 return true; 1487 return true;
1669 } 1488 }
1670 1489
1490 WebGLTexture* WebGL2RenderingContextBase::validateTexImageBinding(const char* fu ncName, TexImageFunctionID functionID, GLenum target)
1491 {
1492 if (functionID == TexImage3D || functionID == TexSubImage3D)
1493 return validateTexture3DBinding(funcName, target);
1494 return validateTexture2DBinding(funcName, target);
1495 }
1496
1671 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, DOMInt32Array* value) 1497 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, DOMInt32Array* value)
1672 { 1498 {
1673 if (isContextLost() || !validateClearBuffer("clearBufferiv", buffer, value-> length())) 1499 if (isContextLost() || !validateClearBuffer("clearBufferiv", buffer, value-> length()))
1674 return; 1500 return;
1675 1501
1676 contextGL()->ClearBufferiv(buffer, drawbuffer, value->data()); 1502 contextGL()->ClearBufferiv(buffer, drawbuffer, value->data());
1677 } 1503 }
1678 1504
1679 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, const Vector<GLint>& value) 1505 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, const Vector<GLint>& value)
1680 { 1506 {
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after
3633 params.skipPixels = m_unpackSkipPixels; 3459 params.skipPixels = m_unpackSkipPixels;
3634 params.skipRows = m_unpackSkipRows; 3460 params.skipRows = m_unpackSkipRows;
3635 if (dimension == Tex3D) { 3461 if (dimension == Tex3D) {
3636 params.imageHeight = m_unpackImageHeight; 3462 params.imageHeight = m_unpackImageHeight;
3637 params.skipImages = m_unpackSkipImages; 3463 params.skipImages = m_unpackSkipImages;
3638 } 3464 }
3639 return params; 3465 return params;
3640 } 3466 }
3641 3467
3642 } // namespace blink 3468 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698