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" |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth) | 923 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth) |
924 { | 924 { |
925 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D)) | 925 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D)) |
926 return; | 926 return; |
927 | 927 |
928 contextGL()->TexStorage3D(target, levels, internalformat, width, height, dep th); | 928 contextGL()->TexStorage3D(target, levels, internalformat, width, height, dep th); |
929 } | 929 } |
930 | 930 |
931 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels) | 931 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels) |
932 { | 932 { |
933 if (isContextLost()) | 933 texImageHelperDOMArrayBufferView(TexImage3D, target, level, internalformat, width, height, border, format, type, depth, 0, 0, 0, pixels); |
934 return; | |
935 if (!validateTexture3DBinding("texImage3D", target)) | |
936 return; | |
937 if (!validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, target, level, internalformat, width, height, depth, border, format, type, 0, 0, 0)) | |
938 return; | |
939 if (!validateTexFuncData("texImage3D", Tex3D, level, width, height, depth, f ormat, type, pixels, NullAllowed)) | |
940 return; | |
941 | |
942 void* data = pixels ? pixels->baseAddress() : 0; | |
943 Vector<uint8_t> tempData; | |
944 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | |
945 // FIXME: WebGLImageConversion needs to be updated to accept image depth . | |
946 NOTIMPLEMENTED(); | |
947 return; | |
948 } | |
949 | |
950 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform at, type), width, height, depth, border, format, type, data); | |
951 } | 934 } |
952 | 935 |
953 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr offset) | 936 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr offset) |
954 { | 937 { |
955 if (isContextLost()) | 938 if (isContextLost()) |
956 return; | 939 return; |
957 if (!validateTexture3DBinding("texImage3D", target)) | 940 if (!validateTexture3DBinding("texImage3D", target)) |
958 return; | 941 return; |
959 if (!m_boundPixelUnpackBuffer) { | 942 if (!m_boundPixelUnpackBuffer) { |
960 synthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "no bound PIXEL_UN PACK_BUFFER"); | 943 synthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "no bound PIXEL_UN PACK_BUFFER"); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 } | 978 } |
996 } | 979 } |
997 | 980 |
998 resetUnpackParameters(); | 981 resetUnpackParameters(); |
999 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, imageEx tractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConvers ion ? data.data() : imagePixelData); | 982 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, imageEx tractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConvers ion ? data.data() : imagePixelData); |
1000 restoreUnpackParameters(); | 983 restoreUnpackParameters(); |
1001 } | 984 } |
1002 | 985 |
1003 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) | 986 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) |
1004 { | 987 { |
1005 if (isContextLost()) | 988 texImageHelperDOMArrayBufferView(TexSubImage3D, target, level, 0, width, hei ght, 0, format, type, depth, xoffset, yoffset, zoffset, pixels); |
1006 return; | |
1007 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1008 return; | |
1009 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceArrayBufferView, ta rget, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset )) | |
1010 return; | |
1011 if (!validateTexFuncData("texSubImage3D", Tex3D, level, width, height, depth , format, type, pixels, NullNotAllowed)) | |
1012 return; | |
1013 | |
1014 void* data = pixels->baseAddress(); | |
1015 Vector<uint8_t> tempData; | |
1016 bool changeUnpackParameters = false; | |
1017 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | |
1018 // FIXME: WebGLImageConversion needs to be updated to accept image depth . | |
1019 NOTIMPLEMENTED(); | |
1020 changeUnpackParameters = true; | |
1021 } | |
1022 if (changeUnpackParameters) | |
1023 resetUnpackParameters(); | |
1024 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data); | |
1025 if (changeUnpackParameters) | |
1026 restoreUnpackParameters(); | |
1027 } | 989 } |
1028 | 990 |
1029 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) | 991 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) |
1030 { | 992 { |
1031 if (isContextLost()) | 993 if (isContextLost()) |
1032 return; | 994 return; |
1033 if (!validateTexture3DBinding("texSubImage3D", target)) | 995 if (!validateTexture3DBinding("texSubImage3D", target)) |
1034 return; | 996 return; |
1035 if (!m_boundPixelUnpackBuffer) { | 997 if (!m_boundPixelUnpackBuffer) { |
1036 synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL _UNPACK_BUFFER"); | 998 synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL _UNPACK_BUFFER"); |
1037 return; | 999 return; |
1038 } | 1000 } |
1039 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) | 1001 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) |
1040 return; | 1002 return; |
1041 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) | 1003 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) |
1042 return; | 1004 return; |
1043 | 1005 |
1044 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, reinterpret_cast<const void*>(offset)); | 1006 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, reinterpret_cast<const void*>(offset)); |
1045 } | 1007 } |
1046 | 1008 |
1047 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p ixels) | 1009 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p ixels) |
1048 { | 1010 { |
1049 if (isContextLost()) | 1011 texImageHelperImageData(TexSubImage3D, target, level, 0, 0, format, type, 1, xoffset, yoffset, zoffset, pixels); |
1050 return; | |
1051 if (!pixels) { | |
1052 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "no image data"); | |
1053 return; | |
1054 } | |
1055 if (pixels->data()->bufferBase()->isNeutered()) { | |
1056 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "The source data ha s been neutered."); | |
1057 return; | |
1058 } | |
1059 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1060 return; | |
1061 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceImageData, target, level, 0, pixels->width(), pixels->height(), 1, 0, format, type, xoffset, yoffse t, zoffset)) | |
1062 return; | |
1063 | |
1064 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | |
1065 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | |
1066 type = GL_FLOAT; | |
1067 } | |
1068 Vector<uint8_t> data; | |
1069 bool needConversion = true; | |
1070 // The data from ImageData is always of format RGBA8. | |
1071 // No conversion is needed if destination format is RGBA and type is USIGNED _BYTE and no Flip or Premultiply operation is required. | |
1072 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE && !m_unpackFlipY && !m_un packPremultiplyAlpha) { | |
1073 needConversion = false; | |
1074 } else { | |
1075 if (!WebGLImageConversion::extractImageData(pixels->data()->data(), WebG LImageConversion::DataFormat::DataFormatRGBA8, pixels->size(), format, type, m_u npackFlipY, m_unpackPremultiplyAlpha, data)) { | |
1076 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data "); | |
1077 return; | |
1078 } | |
1079 } | |
1080 resetUnpackParameters(); | |
1081 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, pixels- >width(), pixels->height(), 1, format, type, needConversion ? data.data() : pixe ls->data()->data()); | |
1082 restoreUnpackParameters(); | |
1083 } | 1012 } |
1084 | 1013 |
1085 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle ment* image, ExceptionState& exceptionState) | 1014 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle ment* image, ExceptionState& exceptionState) |
1086 { | 1015 { |
1087 if (isContextLost()) | 1016 bool succeed = texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type, xoffset, yoffset, zoffset, image, exceptionState); |
Ken Russell (switch to Gerrit)
2016/06/01 00:34:03
It's very confusing that this is expected to fall
xidachen
2016/06/01 19:59:15
I agree. It seems that the only reason that there
Ken Russell (switch to Gerrit)
2016/06/02 00:58:49
Yes, but as we discussed offline, the very differe
| |
1088 return; | 1017 if (!succeed) |
1089 if (!validateHTMLImageElement("texSubImage3D", image, exceptionState)) | |
1090 return; | |
1091 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1092 return; | 1018 return; |
1093 | 1019 |
1094 RefPtr<Image> imageForRender = image->cachedImage()->getImage(); | 1020 RefPtr<Image> imageForRender = image->cachedImage()->getImage(); |
1095 if (imageForRender->isSVGImage()) | 1021 if (imageForRender->isSVGImage()) |
1096 imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width( ), image->height(), "texSubImage3D"); | 1022 imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width( ), image->height(), "texSubImage3D"); |
1097 | 1023 |
1098 if (!imageForRender || !validateTexFunc("texSubImage3D", TexSubImage, Source HTMLImageElement, target, level, 0, imageForRender->width(), imageForRender->hei ght(), 1, 0, format, type, xoffset, yoffset, zoffset)) | 1024 if (!imageForRender || !validateTexFunc("texSubImage3D", TexSubImage, Source HTMLImageElement, target, level, 0, imageForRender->width(), imageForRender->hei ght(), 1, 0, format, type, xoffset, yoffset, zoffset)) |
1099 return; | 1025 return; |
1100 | 1026 |
1101 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im ageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackP remultiplyAlpha); | 1027 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im ageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackP remultiplyAlpha); |
1102 } | 1028 } |
1103 | 1029 |
1104 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) | 1030 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) |
1105 { | 1031 { |
1106 if (isContextLost()) | 1032 WebGLTexture* texture = texImageHelperHTMLCanvasElement(TexSubImage3D, targe t, level, 0, format, type, xoffset, yoffset, zoffset, canvas, exceptionState); |
1107 return; | 1033 if (!texture) |
1108 if (!validateHTMLCanvasElement("texSubImage3D", canvas, exceptionState)) | |
1109 return; | |
1110 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1111 return; | |
1112 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLCanvasElement, target, level, 0, canvas->width(), canvas->height(), 1, 0, format, type, xoffset , yoffset, zoffset)) | |
1113 return; | 1034 return; |
1114 | 1035 |
1115 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269). | 1036 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269). |
1116 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, ca nvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 1037 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, ca nvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
1117 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyA lpha); | 1038 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyA lpha); |
1118 } | 1039 } |
1119 | 1040 |
1120 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) | 1041 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) |
1121 { | 1042 { |
1122 if (isContextLost()) | 1043 WebGLTexture* texture = texImageHelperHTMLVideoElement(TexSubImage3D, target , level, 0, format, type, xoffset, yoffset, zoffset, video, exceptionState); |
1123 return; | 1044 if (!texture) |
1124 if (!validateHTMLVideoElement("texSubImage3D", video, exceptionState)) | |
1125 return; | |
1126 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1127 return; | |
1128 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLVideoElement, t arget, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, type, xoffset, yoffset, zoffset)) | |
1129 return; | 1045 return; |
1130 | 1046 |
1131 RefPtr<Image> image = videoFrameToImage(video); | 1047 RefPtr<Image> image = videoFrameToImage(video); |
1132 if (!image) | 1048 if (!image) |
1133 return; | 1049 return; |
1134 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im age.get(), WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultipl yAlpha); | 1050 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im age.get(), WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultipl yAlpha); |
1135 } | 1051 } |
1136 | 1052 |
1137 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageBitmap* bitmap, ExceptionState& exceptionState) | 1053 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageBitmap* bitmap, ExceptionState& exceptionState) |
1138 { | 1054 { |
1139 if (isContextLost()) | 1055 texImageHelperImageBitmap(TexSubImage3D, target, level, 0, format, type, xof fset, yoffset, zoffset, bitmap, exceptionState); |
1140 return; | |
1141 if (!validateImageBitmap("texSubImage3D", bitmap, exceptionState)) | |
1142 return; | |
1143 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1144 return; | |
1145 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceImageBitmap, target , level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, xoffset, yoff set, zoffset)) | |
1146 return; | |
1147 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | |
1148 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | |
1149 type = GL_FLOAT; | |
1150 } | |
1151 ASSERT(bitmap->bitmapImage()); | |
1152 RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); | |
1153 SkPixmap pixmap; | |
1154 OwnPtr<uint8_t[]> pixelData; | |
1155 uint8_t* pixelDataPtr = nullptr; | |
1156 bool peekSucceed = skImage->peekPixels(&pixmap); | |
1157 if (peekSucceed) { | |
1158 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); | |
1159 } else if (skImage->isTextureBacked()) { | |
1160 pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? Premultip lyAlpha : DontPremultiplyAlpha); | |
1161 pixelDataPtr = pixelData.get(); | |
1162 } | |
1163 Vector<uint8_t> data; | |
1164 bool needConversion = true; | |
1165 bool havePeekableRGBA = (peekSucceed && pixmap.colorType() == SkColorType::k RGBA_8888_SkColorType); | |
1166 bool isPixelDataRBGA = (havePeekableRGBA || !peekSucceed); | |
1167 if (isPixelDataRBGA && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { | |
1168 needConversion = false; | |
1169 } else { | |
1170 // In the case of ImageBitmap, we do not need to apply flipY or premulti plyAlpha. | |
1171 bool isPixelDataBGRA = (peekSucceed && pixmap.colorType() == SkColorType ::kBGRA_8888_SkColorType); | |
1172 if ((isPixelDataBGRA && !WebGLImageConversion::extractImageData(pixelDat aPtr, WebGLImageConversion::DataFormat::DataFormatBGRA8, bitmap->size(), format, type, false, false, data)) | |
1173 || (isPixelDataRBGA && !WebGLImageConversion::extractImageData(pixel DataPtr, WebGLImageConversion::DataFormat::DataFormatRGBA8, bitmap->size(), form at, type, false, false, data))) { | |
1174 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data "); | |
1175 return; | |
1176 } | |
1177 } | |
1178 resetUnpackParameters(); | |
1179 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, bitmap- >width(), bitmap->height(), 1, format, type, needConversion ? data.data() : pixe lDataPtr); | |
1180 restoreUnpackParameters(); | |
1181 } | 1056 } |
1182 | 1057 |
1183 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height) | 1058 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height) |
1184 { | 1059 { |
1185 if (isContextLost()) | 1060 if (isContextLost()) |
1186 return; | 1061 return; |
1187 if (!validateTexture3DBinding("copyTexSubImage3D", target)) | 1062 if (!validateTexture3DBinding("copyTexSubImage3D", target)) |
1188 return; | 1063 return; |
1189 WebGLFramebuffer* readFramebufferBinding = nullptr; | 1064 WebGLFramebuffer* readFramebufferBinding = nullptr; |
1190 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin g)) | 1065 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin g)) |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1631 return false; | 1506 return false; |
1632 } | 1507 } |
1633 break; | 1508 break; |
1634 default: | 1509 default: |
1635 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid buffer"); | 1510 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid buffer"); |
1636 return false; | 1511 return false; |
1637 } | 1512 } |
1638 return true; | 1513 return true; |
1639 } | 1514 } |
1640 | 1515 |
1516 WebGLTexture* WebGL2RenderingContextBase::validateTexImageBinding(const char* fu ncName, TexImageFunctionName functionName, GLenum target) | |
1517 { | |
1518 if (functionName == TexImage3D || functionName == TexSubImage3D) | |
1519 return validateTexture3DBinding(funcName, target); | |
1520 return validateTexture2DBinding(funcName, target); | |
1521 } | |
1522 | |
1641 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, DOMInt32Array* value) | 1523 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, DOMInt32Array* value) |
1642 { | 1524 { |
1643 if (isContextLost() || !validateClearBuffer("clearBufferiv", buffer, value-> length())) | 1525 if (isContextLost() || !validateClearBuffer("clearBufferiv", buffer, value-> length())) |
1644 return; | 1526 return; |
1645 | 1527 |
1646 contextGL()->ClearBufferiv(buffer, drawbuffer, value->data()); | 1528 contextGL()->ClearBufferiv(buffer, drawbuffer, value->data()); |
1647 } | 1529 } |
1648 | 1530 |
1649 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, const Vector<GLint>& value) | 1531 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer, const Vector<GLint>& value) |
1650 { | 1532 { |
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3603 params.skipPixels = m_unpackSkipPixels; | 3485 params.skipPixels = m_unpackSkipPixels; |
3604 params.skipRows = m_unpackSkipRows; | 3486 params.skipRows = m_unpackSkipRows; |
3605 if (dimension == Tex3D) { | 3487 if (dimension == Tex3D) { |
3606 params.imageHeight = m_unpackImageHeight; | 3488 params.imageHeight = m_unpackImageHeight; |
3607 params.skipImages = m_unpackSkipImages; | 3489 params.skipImages = m_unpackSkipImages; |
3608 } | 3490 } |
3609 return params; | 3491 return params; |
3610 } | 3492 } |
3611 | 3493 |
3612 } // namespace blink | 3494 } // namespace blink |
OLD | NEW |