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"); |
961 return; | 944 return; |
962 } | 945 } |
963 if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, lev
el, internalformat, width, height, depth, border, format, type, 0, 0, 0)) | 946 if (!validateTexFunc("texImage3D", TexImage, SourceUnpackBuffer, target, lev
el, internalformat, width, height, depth, border, format, type, 0, 0, 0)) |
964 return; | 947 return; |
965 if (!validateValueFitNonNegInt32("texImage3D", "offset", offset)) | 948 if (!validateValueFitNonNegInt32("texImage3D", "offset", offset)) |
966 return; | 949 return; |
967 | 950 |
968 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform
at, type), width, height, depth, border, format, type, reinterpret_cast<const vo
id *>(offset)); | 951 contextGL()->TexImage3D(target, level, convertTexInternalFormat(internalform
at, type), width, height, depth, border, format, type, reinterpret_cast<const vo
id *>(offset)); |
969 } | 952 } |
970 | 953 |
971 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) | |
972 { | |
973 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | |
974 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | |
975 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | |
976 type = GL_FLOAT; | |
977 } | |
978 Vector<uint8_t> data; | |
979 WebGLImageConversion::ImageExtractor imageExtractor(image, domSource, premul
tiplyAlpha, m_unpackColorspaceConversion == GL_NONE); | |
980 if (!imageExtractor.imagePixelData()) { | |
981 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image"); | |
982 return; | |
983 } | |
984 WebGLImageConversion::DataFormat sourceDataFormat = imageExtractor.imageSour
ceFormat(); | |
985 WebGLImageConversion::AlphaOp alphaOp = imageExtractor.imageAlphaOp(); | |
986 const void* imagePixelData = imageExtractor.imagePixelData(); | |
987 | |
988 bool needConversion = true; | |
989 if (type == GL_UNSIGNED_BYTE && sourceDataFormat == WebGLImageConversion::Da
taFormatRGBA8 && format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNo
thing && !flipY) { | |
990 needConversion = false; | |
991 } else { | |
992 if (!WebGLImageConversion::packImageData(image, imagePixelData, format,
type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtrac
tor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) { | |
993 synthesizeGLError(GL_INVALID_VALUE, "texSubImage3D", "bad image data
"); | |
994 return; | |
995 } | |
996 } | |
997 | |
998 resetUnpackParameters(); | |
999 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, imageEx
tractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConvers
ion ? data.data() : imagePixelData); | |
1000 restoreUnpackParameters(); | |
1001 } | |
1002 | |
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) | 954 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 { | 955 { |
1005 if (isContextLost()) | 956 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 } | 957 } |
1028 | 958 |
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) | 959 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 { | 960 { |
1031 if (isContextLost()) | 961 if (isContextLost()) |
1032 return; | 962 return; |
1033 if (!validateTexture3DBinding("texSubImage3D", target)) | 963 if (!validateTexture3DBinding("texSubImage3D", target)) |
1034 return; | 964 return; |
1035 if (!m_boundPixelUnpackBuffer) { | 965 if (!m_boundPixelUnpackBuffer) { |
1036 synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL
_UNPACK_BUFFER"); | 966 synthesizeGLError(GL_INVALID_OPERATION, "texSubImage3D", "no bound PIXEL
_UNPACK_BUFFER"); |
1037 return; | 967 return; |
1038 } | 968 } |
1039 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe
t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) | 969 if (!validateTexFunc("texSubImage3D", TexSubImage, SourceUnpackBuffer, targe
t, level, 0, width, height, depth, 0, format, type, xoffset, yoffset, zoffset)) |
1040 return; | 970 return; |
1041 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) | 971 if (!validateValueFitNonNegInt32("texSubImage3D", "offset", offset)) |
1042 return; | 972 return; |
1043 | 973 |
1044 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
height, depth, format, type, reinterpret_cast<const void*>(offset)); | 974 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
height, depth, format, type, reinterpret_cast<const void*>(offset)); |
1045 } | 975 } |
1046 | 976 |
1047 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p
ixels) | 977 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageData* p
ixels) |
1048 { | 978 { |
1049 if (isContextLost()) | 979 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 } | 980 } |
1084 | 981 |
1085 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle
ment* image, ExceptionState& exceptionState) | 982 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLImageEle
ment* image, ExceptionState& exceptionState) |
1086 { | 983 { |
1087 if (isContextLost()) | 984 texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type
, xoffset, yoffset, zoffset, image, exceptionState); |
1088 return; | |
1089 if (!validateHTMLImageElement("texSubImage3D", image, exceptionState)) | |
1090 return; | |
1091 if (!validateTexture3DBinding("texSubImage3D", target)) | |
1092 return; | |
1093 | |
1094 RefPtr<Image> imageForRender = image->cachedImage()->getImage(); | |
1095 if (imageForRender->isSVGImage()) | |
1096 imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(
), image->height(), "texSubImage3D"); | |
1097 | |
1098 if (!imageForRender || !validateTexFunc("texSubImage3D", TexSubImage, Source
HTMLImageElement, target, level, 0, imageForRender->width(), imageForRender->hei
ght(), 1, 0, format, type, xoffset, yoffset, zoffset)) | |
1099 return; | |
1100 | |
1101 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im
ageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackP
remultiplyAlpha); | |
1102 } | 985 } |
1103 | 986 |
1104 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl
ement* canvas, ExceptionState& exceptionState) | 987 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl
ement* canvas, ExceptionState& exceptionState) |
1105 { | 988 { |
1106 if (isContextLost()) | 989 texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, typ
e, xoffset, yoffset, zoffset, canvas, exceptionState); |
1107 return; | |
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; | |
1114 | |
1115 // 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(), | |
1117 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyA
lpha); | |
1118 } | 990 } |
1119 | 991 |
1120 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle
ment* video, ExceptionState& exceptionState) | 992 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle
ment* video, ExceptionState& exceptionState) |
1121 { | 993 { |
1122 if (isContextLost()) | 994 texImageHelperHTMLVideoElement(TexSubImage3D, target, level, 0, format, type
, xoffset, yoffset, zoffset, video, exceptionState); |
1123 return; | |
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; | |
1130 | |
1131 RefPtr<Image> image = videoFrameToImage(video); | |
1132 if (!image) | |
1133 return; | |
1134 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im
age.get(), WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultipl
yAlpha); | |
1135 } | 995 } |
1136 | 996 |
1137 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageBitmap*
bitmap, ExceptionState& exceptionState) | 997 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, ImageBitmap*
bitmap, ExceptionState& exceptionState) |
1138 { | 998 { |
1139 if (isContextLost()) | 999 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 } | 1000 } |
1182 | 1001 |
1183 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G
Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs
izei height) | 1002 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G
Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs
izei height) |
1184 { | 1003 { |
1185 if (isContextLost()) | 1004 if (isContextLost()) |
1186 return; | 1005 return; |
1187 if (!validateTexture3DBinding("copyTexSubImage3D", target)) | 1006 if (!validateTexture3DBinding("copyTexSubImage3D", target)) |
1188 return; | 1007 return; |
1189 WebGLFramebuffer* readFramebufferBinding = nullptr; | 1008 WebGLFramebuffer* readFramebufferBinding = nullptr; |
1190 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin
g)) | 1009 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin
g)) |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 return false; | 1450 return false; |
1632 } | 1451 } |
1633 break; | 1452 break; |
1634 default: | 1453 default: |
1635 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid buffer"); | 1454 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid buffer"); |
1636 return false; | 1455 return false; |
1637 } | 1456 } |
1638 return true; | 1457 return true; |
1639 } | 1458 } |
1640 | 1459 |
| 1460 WebGLTexture* WebGL2RenderingContextBase::validateTexImageBinding(const char* fu
ncName, TexImageFunctionID functionID, GLenum target) |
| 1461 { |
| 1462 if (functionID == TexImage3D || functionID == TexSubImage3D) |
| 1463 return validateTexture3DBinding(funcName, target); |
| 1464 return validateTexture2DBinding(funcName, target); |
| 1465 } |
| 1466 |
1641 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer,
DOMInt32Array* value) | 1467 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer,
DOMInt32Array* value) |
1642 { | 1468 { |
1643 if (isContextLost() || !validateClearBuffer("clearBufferiv", buffer, value->
length())) | 1469 if (isContextLost() || !validateClearBuffer("clearBufferiv", buffer, value->
length())) |
1644 return; | 1470 return; |
1645 | 1471 |
1646 contextGL()->ClearBufferiv(buffer, drawbuffer, value->data()); | 1472 contextGL()->ClearBufferiv(buffer, drawbuffer, value->data()); |
1647 } | 1473 } |
1648 | 1474 |
1649 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer,
const Vector<GLint>& value) | 1475 void WebGL2RenderingContextBase::clearBufferiv(GLenum buffer, GLint drawbuffer,
const Vector<GLint>& value) |
1650 { | 1476 { |
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 params.skipPixels = m_unpackSkipPixels; | 3429 params.skipPixels = m_unpackSkipPixels; |
3604 params.skipRows = m_unpackSkipRows; | 3430 params.skipRows = m_unpackSkipRows; |
3605 if (dimension == Tex3D) { | 3431 if (dimension == Tex3D) { |
3606 params.imageHeight = m_unpackImageHeight; | 3432 params.imageHeight = m_unpackImageHeight; |
3607 params.skipImages = m_unpackSkipImages; | 3433 params.skipImages = m_unpackSkipImages; |
3608 } | 3434 } |
3609 return params; | 3435 return params; |
3610 } | 3436 } |
3611 | 3437 |
3612 } // namespace blink | 3438 } // namespace blink |
OLD | NEW |