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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid 2D target" ); | 798 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid 2D target" ); |
799 return false; | 799 return false; |
800 } | 800 } |
801 } else { | 801 } else { |
802 if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY) { | 802 if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY) { |
803 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid 3D target" ); | 803 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid 3D target" ); |
804 return false; | 804 return false; |
805 } | 805 } |
806 } | 806 } |
807 | 807 |
808 WebGLTexture* tex = validateTextureBinding(functionName, target, false); | |
809 if (!tex) | |
810 return false; | |
811 | |
812 if (functionType == TexStorageType3D && target != GL_TEXTURE_2D_ARRAY && m_c ompressedTextureFormatsETC2EAC.find(internalformat) != m_compressedTextureFormat sETC2EAC.end()) { | 808 if (functionType == TexStorageType3D && target != GL_TEXTURE_2D_ARRAY && m_c ompressedTextureFormatsETC2EAC.find(internalformat) != m_compressedTextureFormat sETC2EAC.end()) { |
813 synthesizeGLError(GL_INVALID_OPERATION, functionName, "target for ETC2/E AC internal formats must be TEXTURE_2D_ARRAY"); | 809 synthesizeGLError(GL_INVALID_OPERATION, functionName, "target for ETC2/E AC internal formats must be TEXTURE_2D_ARRAY"); |
814 return false; | 810 return false; |
815 } | 811 } |
816 | 812 |
817 if (m_supportedInternalFormatsStorage.find(internalformat) == m_supportedInt ernalFormatsStorage.end()) { | 813 if (m_supportedInternalFormatsStorage.find(internalformat) == m_supportedInt ernalFormatsStorage.end()) { |
818 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat "); | 814 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat "); |
819 return false; | 815 return false; |
820 } | 816 } |
821 | 817 |
822 if (tex->isImmutable()) { | |
823 synthesizeGLError(GL_INVALID_OPERATION, functionName, "attempted to modi fy immutable texture"); | |
824 return false; | |
825 } | |
826 | |
827 if (width <= 0 || height <= 0 || depth <= 0) { | 818 if (width <= 0 || height <= 0 || depth <= 0) { |
828 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid dimensions"); | 819 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid dimensions"); |
829 return false; | 820 return false; |
830 } | 821 } |
831 | 822 |
832 if (levels <= 0) { | 823 if (levels <= 0) { |
833 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid levels"); | 824 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid levels"); |
834 return false; | 825 return false; |
835 } | 826 } |
836 | 827 |
(...skipping 10 matching lines...) Expand all Loading... | |
847 } | 838 } |
848 | 839 |
849 return true; | 840 return true; |
850 } | 841 } |
851 | 842 |
852 void WebGL2RenderingContextBase::texStorage2D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height) | 843 void WebGL2RenderingContextBase::texStorage2D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height) |
853 { | 844 { |
854 if (isContextLost() || !validateTexStorage("texStorage2D", target, levels, i nternalformat, width, height, 1, TexStorageType2D)) | 845 if (isContextLost() || !validateTexStorage("texStorage2D", target, levels, i nternalformat, width, height, 1, TexStorageType2D)) |
855 return; | 846 return; |
856 | 847 |
857 WebGLTexture* tex = validateTextureBinding("texStorage2D", target, false); | |
858 webContext()->texStorage2DEXT(target, levels, internalformat, width, height) ; | 848 webContext()->texStorage2DEXT(target, levels, internalformat, width, height) ; |
859 tex->setTexStorageInfo(target, levels, internalformat, width, height, 1); | |
860 } | 849 } |
861 | 850 |
862 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth) | 851 void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe num internalformat, GLsizei width, GLsizei height, GLsizei depth) |
863 { | 852 { |
864 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D)) | 853 if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, i nternalformat, width, height, depth, TexStorageType3D)) |
865 return; | 854 return; |
866 | 855 |
867 WebGLTexture* tex = validateTextureBinding("texStorage3D", target, false); | |
868 webContext()->texStorage3D(target, levels, internalformat, width, height, de pth); | 856 webContext()->texStorage3D(target, levels, internalformat, width, height, de pth); |
869 tex->setTexStorageInfo(target, levels, internalformat, width, height, depth) ; | |
870 } | 857 } |
871 | 858 |
872 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels) | 859 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels) |
873 { | 860 { |
874 if (isContextLost() || !validateTexFunc3DTarget("texImage3D", target) | 861 if (isContextLost() || !validateTexFunc3DTarget("texImage3D", target) |
875 || !validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, targe t, level, internalformat, width, height, depth, border, format, type, 0, 0, 0) | 862 || !validateTexFunc("texImage3D", TexImage, SourceArrayBufferView, targe t, level, internalformat, width, height, depth, border, format, type, 0, 0, 0) |
876 || !validateTexFuncData("texImage3D", level, width, height, depth, forma t, type, pixels, NullAllowed)) | 863 || !validateTexFuncData("texImage3D", level, width, height, depth, forma t, type, pixels, NullAllowed)) |
877 return; | 864 return; |
878 | 865 |
879 void* data = pixels ? pixels->baseAddress() : 0; | 866 void* data = pixels ? pixels->baseAddress() : 0; |
880 Vector<uint8_t> tempData; | 867 Vector<uint8_t> tempData; |
881 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 868 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
882 // FIXME: WebGLImageConversion needs to be updated to accept image depth . | 869 // FIXME: WebGLImageConversion needs to be updated to accept image depth . |
883 notImplemented(); | 870 notImplemented(); |
884 return; | 871 return; |
885 } | 872 } |
886 | 873 |
887 WebGLTexture* tex = validateTextureBinding("texImage3D", target, true); | |
888 ASSERT(tex); | |
889 webContext()->texImage3D(target, level, convertTexInternalFormat(internalfor mat, type), width, height, depth, border, format, type, data); | 874 webContext()->texImage3D(target, level, convertTexInternalFormat(internalfor mat, type), width, height, depth, border, format, type, data); |
890 tex->setLevelInfo(target, level, internalformat, width, height, depth, type) ; | |
891 } | 875 } |
892 | 876 |
893 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) | 877 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) |
894 { | 878 { |
895 // All calling functions check isContextLost, so a duplicate check is not ne eded here. | 879 // All calling functions check isContextLost, so a duplicate check is not ne eded here. |
896 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | 880 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { |
897 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | 881 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. |
898 type = GL_FLOAT; | 882 type = GL_FLOAT; |
899 } | 883 } |
900 Vector<uint8_t> data; | 884 Vector<uint8_t> data; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im ageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackP remultiplyAlpha); | 979 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, im ageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackP remultiplyAlpha); |
996 } | 980 } |
997 | 981 |
998 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) | 982 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) |
999 { | 983 { |
1000 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState) | 984 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState) |
1001 || !validateTexFunc3DTarget("texSubImage3D", target) | 985 || !validateTexFunc3DTarget("texSubImage3D", target) |
1002 || !validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLCanvasElemen t, target, level, 0, canvas->width(), canvas->height(), 1, 0, format, type, xoff set, yoffset, zoffset)) | 986 || !validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLCanvasElemen t, target, level, 0, canvas->width(), canvas->height(), 1, 0, format, type, xoff set, yoffset, zoffset)) |
1003 return; | 987 return; |
1004 | 988 |
1005 WebGLTexture* texture = validateTextureBinding("texSubImage3D", target, fals e); | 989 // FIXME: Implement GPU-to-GPU copy path. |
Ken Russell (switch to Gerrit)
2016/02/11 01:25:01
Could you provide more details about exactly what'
Zhenyao Mo
2016/02/11 02:16:46
Sure, I'll create a bug with more details. But le
| |
1006 ASSERT(texture); | 990 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, ca nvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
1007 GLenum internalformat = texture->getInternalFormat(target, level); | 991 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyA lpha); |
1008 | |
1009 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d() || !canUseTexImageCanvasByGPU(internalformat, type)) { | |
1010 // 2D canvas has only FrontBuffer. | |
1011 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | |
1012 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); | |
1013 return; | |
1014 } | |
1015 | |
1016 texImageCanvasByGPU(TexSubImage3DByGPU, texture, target, level, GL_RGBA, typ e, xoffset, yoffset, zoffset, canvas); | |
1017 } | 992 } |
1018 | 993 |
1019 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) | 994 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) |
1020 { | 995 { |
1021 if (isContextLost() || !validateHTMLVideoElement("texSubImage3D", video, exc eptionState) | 996 if (isContextLost() || !validateHTMLVideoElement("texSubImage3D", video, exc eptionState) |
1022 || !validateTexFunc3DTarget("texSubImage3D", target) | 997 || !validateTexFunc3DTarget("texSubImage3D", target) |
1023 || !validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLVideoElement , target, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, typ e, xoffset, yoffset, zoffset)) | 998 || !validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLVideoElement , target, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, typ e, xoffset, yoffset, zoffset)) |
1024 return; | 999 return; |
1025 | 1000 |
1026 RefPtr<Image> image = videoFrameToImage(video); | 1001 RefPtr<Image> image = videoFrameToImage(video); |
(...skipping 16 matching lines...) Expand all Loading... | |
1043 | 1018 |
1044 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height) | 1019 void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G Lint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLs izei height) |
1045 { | 1020 { |
1046 if (isContextLost()) | 1021 if (isContextLost()) |
1047 return; | 1022 return; |
1048 WebGLFramebuffer* readFramebufferBinding = nullptr; | 1023 WebGLFramebuffer* readFramebufferBinding = nullptr; |
1049 if (!validateCopyTexSubImage("copyTexSubImage3D", target, level, xoffset, yo ffset, zoffset, x, y, width, height)) | 1024 if (!validateCopyTexSubImage("copyTexSubImage3D", target, level, xoffset, yo ffset, zoffset, x, y, width, height)) |
1050 return; | 1025 return; |
1051 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin g)) | 1026 if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBindin g)) |
1052 return; | 1027 return; |
1053 WebGLTexture* tex = validateTextureBinding("copyTexSubImage3D", target, true ); | |
1054 ASSERT(tex); | |
1055 if (!isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(t arget, level), boundFramebufferColorFormat())) { | |
1056 synthesizeGLError(GL_INVALID_OPERATION, "copyTexSubImage3D", "framebuffe r is incompatible format"); | |
1057 return; | |
1058 } | |
1059 clearIfComposited(); | 1028 clearIfComposited(); |
1060 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); | 1029 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); |
1061 webContext()->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); | 1030 webContext()->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); |
1062 } | 1031 } |
1063 | 1032 |
1064 void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level , GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint bor der, DOMArrayBufferView* data) | 1033 void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level , GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint bor der, DOMArrayBufferView* data) |
1065 { | 1034 { |
1066 if (isContextLost()) | 1035 if (isContextLost()) |
1067 return; | 1036 return; |
1068 if (!validateTexFunc3DTarget("compressedTexImage3D", target)) | 1037 if (!validateTexFunc3DTarget("compressedTexImage3D", target)) |
1069 return; | 1038 return; |
1070 if (!validateTexFuncLevel("compressedTexImage3D", target, level)) | 1039 if (!validateTexFuncLevel("compressedTexImage3D", target, level)) |
1071 return; | 1040 return; |
1072 if (!validateCompressedTexFormat("compressedTexImage3D", internalformat)) | 1041 if (!validateCompressedTexFormat("compressedTexImage3D", internalformat)) |
1073 return; | 1042 return; |
1074 if (border) { | 1043 if (border) { |
1075 synthesizeGLError(GL_INVALID_VALUE, "compressedTexImage3D", "border not 0"); | 1044 synthesizeGLError(GL_INVALID_VALUE, "compressedTexImage3D", "border not 0"); |
1076 return; | 1045 return; |
1077 } | 1046 } |
1078 if (!validateCompressedTexDimensions("compressedTexImage3D", CompressedTexIm age, target, level, width, height, depth, internalformat)) | 1047 if (!validateCompressedTexDimensions("compressedTexImage3D", CompressedTexIm age, target, level, width, height, depth, internalformat)) |
1079 return; | 1048 return; |
1080 if (!validateCompressedTexFuncData("compressedTexImage3D", width, height, de pth, internalformat, data)) | 1049 if (!validateCompressedTexFuncData("compressedTexImage3D", width, height, de pth, internalformat, data)) |
1081 return; | 1050 return; |
1082 | 1051 |
1083 WebGLTexture* tex = validateTextureBinding("compressedTexImage3D", target, t rue); | |
1084 if (!tex) | |
1085 return; | |
1086 if (tex->isImmutable()) { | |
1087 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture"); | |
1088 return; | |
1089 } | |
1090 | |
1091 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress()); | 1052 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress()); |
1092 tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UN SIGNED_BYTE); | |
1093 } | 1053 } |
1094 | 1054 |
1095 void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le vel, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data) | 1055 void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le vel, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data) |
1096 { | 1056 { |
1097 if (isContextLost()) | 1057 if (isContextLost()) |
1098 return; | 1058 return; |
1099 if (!validateTexFunc3DTarget("compressedTexSubImage3D", target)) | 1059 if (!validateTexFunc3DTarget("compressedTexSubImage3D", target)) |
1100 return; | 1060 return; |
1101 WebGLTexture* tex = validateTextureBinding("compressedTexSubImage3D", target , true); | 1061 WebGLTexture* tex = validateTextureBinding("compressedTexSubImage3D", target , true); |
1102 if (!tex) | 1062 if (!tex) |
1103 return; | 1063 return; |
1104 if (!validateTexFuncLevel("compressedTexSubImage3D", target, level)) | 1064 if (!validateTexFuncLevel("compressedTexSubImage3D", target, level)) |
1105 return; | 1065 return; |
1106 if (!validateCompressedTexFormat("compressedTexSubImage3D", format)) | 1066 if (!validateCompressedTexFormat("compressedTexSubImage3D", format)) |
1107 return; | 1067 return; |
1108 if (format != tex->getInternalFormat(target, level)) { | |
1109 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexSubImage3D", "form at does not match texture format"); | |
1110 return; | |
1111 } | |
1112 if (!validateCompressedTexSubDimensions("compressedTexSubImage3D", target, l evel, xoffset, yoffset, zoffset, width, height, depth, format, tex)) | 1068 if (!validateCompressedTexSubDimensions("compressedTexSubImage3D", target, l evel, xoffset, yoffset, zoffset, width, height, depth, format, tex)) |
1113 return; | 1069 return; |
1114 if (!validateCompressedTexFuncData("compressedTexSubImage3D", width, height, depth, format, data)) | 1070 if (!validateCompressedTexFuncData("compressedTexSubImage3D", width, height, depth, format, data)) |
1115 return; | 1071 return; |
1116 webContext()->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffs et, | 1072 webContext()->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffs et, |
1117 width, height, depth, format, data->byteLength(), data->baseAddress()); | 1073 width, height, depth, format, data->byteLength(), data->baseAddress()); |
1118 } | 1074 } |
1119 | 1075 |
1120 GLint WebGL2RenderingContextBase::getFragDataLocation(WebGLProgram* program, con st String& name) | 1076 GLint WebGL2RenderingContextBase::getFragDataLocation(WebGLProgram* program, con st String& name) |
1121 { | 1077 { |
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3458 | 3414 |
3459 WebGLRenderingContextBase::removeBoundBuffer(buffer); | 3415 WebGLRenderingContextBase::removeBoundBuffer(buffer); |
3460 } | 3416 } |
3461 | 3417 |
3462 void WebGL2RenderingContextBase::restoreCurrentFramebuffer() | 3418 void WebGL2RenderingContextBase::restoreCurrentFramebuffer() |
3463 { | 3419 { |
3464 bindFramebuffer(nullptr, GL_DRAW_FRAMEBUFFER, m_framebufferBinding.get()); | 3420 bindFramebuffer(nullptr, GL_DRAW_FRAMEBUFFER, m_framebufferBinding.get()); |
3465 bindFramebuffer(nullptr, GL_READ_FRAMEBUFFER, m_readFramebufferBinding.get() ); | 3421 bindFramebuffer(nullptr, GL_READ_FRAMEBUFFER, m_readFramebufferBinding.get() ); |
3466 } | 3422 } |
3467 | 3423 |
3468 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | |
3469 { | |
3470 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | |
3471 return m_readFramebufferBinding->colorBufferFormat(); | |
3472 if (m_requestedAttributes.alpha()) | |
3473 return GL_RGBA; | |
3474 return GL_RGB; | |
3475 } | |
3476 | |
3477 const WebGLSamplerState* WebGL2RenderingContextBase::getTextureUnitSamplerState( GLenum target, GLuint unit) const | 3424 const WebGLSamplerState* WebGL2RenderingContextBase::getTextureUnitSamplerState( GLenum target, GLuint unit) const |
3478 { | 3425 { |
3479 ASSERT(unit < m_samplerUnits.size()); | 3426 ASSERT(unit < m_samplerUnits.size()); |
3480 | 3427 |
3481 WebGLSampler* sampler = m_samplerUnits[unit]; | 3428 WebGLSampler* sampler = m_samplerUnits[unit]; |
3482 | 3429 |
3483 if (sampler) | 3430 if (sampler) |
3484 return sampler->getSamplerState(); | 3431 return sampler->getSamplerState(); |
3485 | 3432 |
3486 return WebGLRenderingContextBase::getTextureUnitSamplerState(target, unit); | 3433 return WebGLRenderingContextBase::getTextureUnitSamplerState(target, unit); |
(...skipping 15 matching lines...) Expand all Loading... | |
3502 params.alignment = m_unpackAlignment; | 3449 params.alignment = m_unpackAlignment; |
3503 params.rowLength = m_unpackRowLength; | 3450 params.rowLength = m_unpackRowLength; |
3504 params.imageHeight = m_unpackImageHeight; | 3451 params.imageHeight = m_unpackImageHeight; |
3505 params.skipPixels = m_unpackSkipPixels; | 3452 params.skipPixels = m_unpackSkipPixels; |
3506 params.skipRows = m_unpackSkipRows; | 3453 params.skipRows = m_unpackSkipRows; |
3507 params.skipImages = m_unpackSkipImages; | 3454 params.skipImages = m_unpackSkipImages; |
3508 return params; | 3455 return params; |
3509 } | 3456 } |
3510 | 3457 |
3511 } // namespace blink | 3458 } // namespace blink |
OLD | NEW |