OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 void restoreStateAfterClear(); | 735 void restoreStateAfterClear(); |
736 | 736 |
737 // Convert texture internal format. | 737 // Convert texture internal format. |
738 GLenum convertTexInternalFormat(GLenum internalformat, GLenum type); | 738 GLenum convertTexInternalFormat(GLenum internalformat, GLenum type); |
739 | 739 |
740 void texImage2DBase(GLenum target, GLint level, GLenum internalformat, GLsiz
ei width, GLsizei height, GLint border, GLenum format, GLenum type, const void*
pixels, ExceptionState&); | 740 void texImage2DBase(GLenum target, GLint level, GLenum internalformat, GLsiz
ei width, GLsizei height, GLint border, GLenum format, GLenum type, const void*
pixels, ExceptionState&); |
741 void texImage2DImpl(GLenum target, GLint level, GLenum internalformat, GLenu
m format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSource, bool fl
ipY, bool premultiplyAlpha, ExceptionState&); | 741 void texImage2DImpl(GLenum target, GLint level, GLenum internalformat, GLenu
m format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSource, bool fl
ipY, bool premultiplyAlpha, ExceptionState&); |
742 void texSubImage2DBase(GLenum target, GLint level, GLint xoffset, GLint yoff
set, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixe
ls, ExceptionState&); | 742 void texSubImage2DBase(GLenum target, GLint level, GLint xoffset, GLint yoff
set, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixe
ls, ExceptionState&); |
743 void texSubImage2DImpl(GLenum target, GLint level, GLint xoffset, GLint yoff
set, GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSourc
e, bool flipY, bool premultiplyAlpha, ExceptionState&); | 743 void texSubImage2DImpl(GLenum target, GLint level, GLint xoffset, GLint yoff
set, GLenum format, GLenum type, Image*, WebGLImageConversion::ImageHtmlDomSourc
e, bool flipY, bool premultiplyAlpha, ExceptionState&); |
744 | 744 |
| 745 enum TexImageFunctionType { |
| 746 NotTexSubImage2D, |
| 747 TexSubImage2D, |
| 748 }; |
| 749 // Copy from the canvas element directly to the texture via the GPU, without
a read-back to system memory. |
| 750 void texImage2DCanvasByGPU(TexImageFunctionType, WebGLTexture*, GLenum targe
t, GLint level, |
| 751 GLenum internalformat, GLenum type, GLint xoffset, GLint yoffset, HTMLCa
nvasElement*); |
| 752 |
745 void handleTextureCompleteness(const char*, bool); | 753 void handleTextureCompleteness(const char*, bool); |
746 void createFallbackBlackTextures1x1(); | 754 void createFallbackBlackTextures1x1(); |
747 | 755 |
748 // Helper function for copyTex{Sub}Image, check whether the internalformat | 756 // Helper function for copyTex{Sub}Image, check whether the internalformat |
749 // and the color buffer format of the current bound framebuffer combination | 757 // and the color buffer format of the current bound framebuffer combination |
750 // is valid. | 758 // is valid. |
751 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat
, GLenum colorBufferFormat); | 759 bool isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat
, GLenum colorBufferFormat); |
752 | 760 |
753 // Helper function to get the bound framebuffer's color buffer format. | 761 // Helper function to get the bound framebuffer's color buffer format. |
754 GLenum boundFramebufferColorFormat(); | 762 GLenum boundFramebufferColorFormat(); |
(...skipping 19 matching lines...) Expand all Loading... |
774 bool validateTexFuncFormatAndType(const char* functionName, GLenum format, G
Lenum type, GLint level); | 782 bool validateTexFuncFormatAndType(const char* functionName, GLenum format, G
Lenum type, GLint level); |
775 | 783 |
776 // Helper function to check input level for functions {copy}Tex{Sub}Image. | 784 // Helper function to check input level for functions {copy}Tex{Sub}Image. |
777 // Generates GL error and returns false if level is invalid. | 785 // Generates GL error and returns false if level is invalid. |
778 bool validateTexFuncLevel(const char* functionName, GLenum target, GLint lev
el); | 786 bool validateTexFuncLevel(const char* functionName, GLenum target, GLint lev
el); |
779 | 787 |
780 // Helper function to check if a 64-bit value is non-negative and can fit in
to a 32-bit integer. | 788 // Helper function to check if a 64-bit value is non-negative and can fit in
to a 32-bit integer. |
781 // Generates GL error and returns false if not. | 789 // Generates GL error and returns false if not. |
782 bool validateValueFitNonNegInt32(const char* functionName, const char* param
Name, long long value); | 790 bool validateValueFitNonNegInt32(const char* functionName, const char* param
Name, long long value); |
783 | 791 |
784 enum TexFuncValidationFunctionType { | |
785 NotTexSubImage2D, | |
786 TexSubImage2D, | |
787 }; | |
788 | |
789 enum TexFuncValidationSourceType { | 792 enum TexFuncValidationSourceType { |
790 SourceArrayBufferView, | 793 SourceArrayBufferView, |
791 SourceImageData, | 794 SourceImageData, |
792 SourceHTMLImageElement, | 795 SourceHTMLImageElement, |
793 SourceHTMLCanvasElement, | 796 SourceHTMLCanvasElement, |
794 SourceHTMLVideoElement, | 797 SourceHTMLVideoElement, |
795 }; | 798 }; |
796 | 799 |
797 // Helper function for tex{Sub}Image2D to check if the input format/type/lev
el/target/width/height/border/xoffset/yoffset are valid. | 800 // Helper function for tex{Sub}Image2D to check if the input format/type/lev
el/target/width/height/border/xoffset/yoffset are valid. |
798 // Otherwise, it would return quickly without doing other work. | 801 // Otherwise, it would return quickly without doing other work. |
799 bool validateTexFunc(const char* functionName, TexFuncValidationFunctionType
, TexFuncValidationSourceType, GLenum target, GLint level, GLenum internalformat
, GLsizei width, | 802 bool validateTexFunc(const char* functionName, TexImageFunctionType, TexFunc
ValidationSourceType, GLenum target, GLint level, GLenum internalformat, GLsizei
width, |
800 GLsizei height, GLint border, GLenum format, GLenum type, GLint xoffset,
GLint yoffset); | 803 GLsizei height, GLint border, GLenum format, GLenum type, GLint xoffset,
GLint yoffset); |
801 | 804 |
802 // Helper function to check input width and height for functions {copy, comp
ressed}Tex{Sub}Image. | 805 // Helper function to check input width and height for functions {copy, comp
ressed}Tex{Sub}Image. |
803 // Generates GL error and returns false if width or height is invalid. | 806 // Generates GL error and returns false if width or height is invalid. |
804 bool validateTexFuncDimensions(const char* functionName, TexFuncValidationFu
nctionType, GLenum target, GLint level, GLsizei width, GLsizei height); | 807 bool validateTexFuncDimensions(const char* functionName, TexImageFunctionTyp
e, GLenum target, GLint level, GLsizei width, GLsizei height); |
805 | 808 |
806 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima
ge. | 809 // Helper function to check input parameters for functions {copy}Tex{Sub}Ima
ge. |
807 // Generates GL error and returns false if parameters are invalid. | 810 // Generates GL error and returns false if parameters are invalid. |
808 bool validateTexFuncParameters(const char* functionName, TexFuncValidationFu
nctionType, GLenum target, GLint level, GLenum internalformat, GLsizei width, GL
sizei height, GLint border, GLenum format, GLenum type); | 811 bool validateTexFuncParameters(const char* functionName, TexImageFunctionTyp
e, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei hei
ght, GLint border, GLenum format, GLenum type); |
809 | 812 |
810 enum NullDisposition { | 813 enum NullDisposition { |
811 NullAllowed, | 814 NullAllowed, |
812 NullNotAllowed | 815 NullNotAllowed |
813 }; | 816 }; |
814 | 817 |
815 // Helper function to validate that the given ArrayBufferView | 818 // Helper function to validate that the given ArrayBufferView |
816 // is of the correct type and contains enough data for the texImage call. | 819 // is of the correct type and contains enough data for the texImage call. |
817 // Generates GL error and returns false if parameters are invalid. | 820 // Generates GL error and returns false if parameters are invalid. |
818 bool validateTexFuncData(const char* functionName, GLint level, GLsizei widt
h, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullD
isposition); | 821 bool validateTexFuncData(const char* functionName, GLint level, GLsizei widt
h, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullD
isposition); |
819 | 822 |
820 // Helper function to validate a given texture format is settable as in | 823 // Helper function to validate a given texture format is settable as in |
821 // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and | 824 // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and |
822 // copyTexSubImage2D. | 825 // copyTexSubImage2D. |
823 // Generates GL error and returns false if the format is not settable. | 826 // Generates GL error and returns false if the format is not settable. |
824 bool validateSettableTexFormat(const char* functionName, GLenum format); | 827 bool validateSettableTexFormat(const char* functionName, GLenum format); |
825 | 828 |
826 // Helper function to validate compressed texture data is correct size | 829 // Helper function to validate compressed texture data is correct size |
827 // for the given format and dimensions. | 830 // for the given format and dimensions. |
828 bool validateCompressedTexFuncData(const char* functionName, GLsizei width,
GLsizei height, GLenum format, DOMArrayBufferView* pixels); | 831 bool validateCompressedTexFuncData(const char* functionName, GLsizei width,
GLsizei height, GLenum format, DOMArrayBufferView* pixels); |
829 | 832 |
830 // Helper function for validating compressed texture formats. | 833 // Helper function for validating compressed texture formats. |
831 bool validateCompressedTexFormat(GLenum format); | 834 bool validateCompressedTexFormat(GLenum format); |
832 | 835 |
833 // Helper function to validate compressed texture dimensions are valid for | 836 // Helper function to validate compressed texture dimensions are valid for |
834 // the given format. | 837 // the given format. |
835 bool validateCompressedTexDimensions(const char* functionName, TexFuncValida
tionFunctionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLe
num format); | 838 bool validateCompressedTexDimensions(const char* functionName, TexImageFunct
ionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum forma
t); |
836 | 839 |
837 // Helper function to validate compressed texture dimensions are valid for | 840 // Helper function to validate compressed texture dimensions are valid for |
838 // the given format. | 841 // the given format. |
839 bool validateCompressedTexSubDimensions(const char* functionName, GLenum tar
get, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, G
Lenum format, WebGLTexture*); | 842 bool validateCompressedTexSubDimensions(const char* functionName, GLenum tar
get, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, G
Lenum format, WebGLTexture*); |
840 | 843 |
841 // Helper function to validate mode for draw{Arrays/Elements}. | 844 // Helper function to validate mode for draw{Arrays/Elements}. |
842 bool validateDrawMode(const char* functionName, GLenum); | 845 bool validateDrawMode(const char* functionName, GLenum); |
843 | 846 |
844 // Helper function to validate if front/back stencilMask and stencilFunc set
tings are the same. | 847 // Helper function to validate if front/back stencilMask and stencilFunc set
tings are the same. |
845 bool validateStencilSettings(const char* functionName); | 848 bool validateStencilSettings(const char* functionName); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 static IntSize oldestContextSize(); | 978 static IntSize oldestContextSize(); |
976 }; | 979 }; |
977 | 980 |
978 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 981 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
979 | 982 |
980 } // namespace blink | 983 } // namespace blink |
981 | 984 |
982 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 985 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
983 | 986 |
984 #endif // WebGLRenderingContextBase_h | 987 #endif // WebGLRenderingContextBase_h |
OLD | NEW |