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

Side by Side Diff: Source/modules/webgl/WebGLRenderingContextBase.h

Issue 1318853003: Implemented copyTexSubImage3D WebGL2 entry point in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 /* 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes)); 709 m_extensions.append(TypedExtensionTracker<T>::create(extensionPtr, flags , prefixes));
710 } 710 }
711 711
712 bool extensionSupportedAndAllowed(const ExtensionTracker*); 712 bool extensionSupportedAndAllowed(const ExtensionTracker*);
713 713
714 inline bool extensionEnabled(WebGLExtensionName name) 714 inline bool extensionEnabled(WebGLExtensionName name)
715 { 715 {
716 return m_extensionEnabled[name]; 716 return m_extensionEnabled[name];
717 } 717 }
718 718
719 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubIm age2D to read from
720 // a multisampled DrawingBuffer. In this situation, we need to blit to a sin gle sampled buffer
721 // for reading, during which the bindings could be changed and need to be re covered.
722 class ScopedDrawingBufferBinder {
723 STACK_ALLOCATED();
724 public:
725 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer * framebufferBinding)
726 : m_drawingBuffer(drawingBuffer)
727 , m_readFramebufferBinding(framebufferBinding)
728 {
729 // Commit DrawingBuffer if needed (e.g., for multisampling)
730 if (!m_readFramebufferBinding && m_drawingBuffer)
731 m_drawingBuffer->commit();
732 }
733
734 ~ScopedDrawingBufferBinder()
735 {
736 // Restore DrawingBuffer if needed
737 if (!m_readFramebufferBinding && m_drawingBuffer)
738 m_drawingBuffer->restoreFramebufferBindings();
739 }
740
741 private:
742 DrawingBuffer* m_drawingBuffer;
743 Member<WebGLFramebuffer> m_readFramebufferBinding;
744 };
745
719 // Errors raised by synthesizeGLError() while the context is lost. 746 // Errors raised by synthesizeGLError() while the context is lost.
720 Vector<GLenum> m_lostContextErrors; 747 Vector<GLenum> m_lostContextErrors;
721 748
722 bool m_isWebGL2FormatsTypesAdded; 749 bool m_isWebGL2FormatsTypesAdded;
723 bool m_isOESTextureFloatFormatsTypesAdded; 750 bool m_isOESTextureFloatFormatsTypesAdded;
724 bool m_isOESTextureHalfFloatFormatsTypesAdded; 751 bool m_isOESTextureHalfFloatFormatsTypesAdded;
725 bool m_isWebGLDepthTextureFormatsTypesAdded; 752 bool m_isWebGLDepthTextureFormatsTypesAdded;
726 bool m_isEXTsRGBFormatsTypesAdded; 753 bool m_isEXTsRGBFormatsTypesAdded;
727 754
728 std::set<GLenum> m_supportedInternalFormats; 755 std::set<GLenum> m_supportedInternalFormats;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 809
783 // Helper function to get the bound framebuffer's color buffer format. 810 // Helper function to get the bound framebuffer's color buffer format.
784 virtual GLenum boundFramebufferColorFormat(); 811 virtual GLenum boundFramebufferColorFormat();
785 812
786 // Helper function to verify limits on the length of uniform and attribute l ocations. 813 // Helper function to verify limits on the length of uniform and attribute l ocations.
787 virtual unsigned getMaxWebGLLocationLength() const { return 256; } 814 virtual unsigned getMaxWebGLLocationLength() const { return 256; }
788 bool validateLocationLength(const char* functionName, const String&); 815 bool validateLocationLength(const char* functionName, const String&);
789 816
790 // Helper function to check if size is non-negative. 817 // Helper function to check if size is non-negative.
791 // Generate GL error and return false for negative inputs; otherwise, return true. 818 // Generate GL error and return false for negative inputs; otherwise, return true.
792 bool validateSize(const char* functionName, GLint x, GLint y); 819 bool validateSize(const char* functionName, GLint x, GLint y, GLint z = 0);
793 820
794 // Helper function to check if all characters in the string belong to the 821 // Helper function to check if all characters in the string belong to the
795 // ASCII subset as defined in GLSL ES 1.0 spec section 3.1. 822 // ASCII subset as defined in GLSL ES 1.0 spec section 3.1.
796 bool validateString(const char* functionName, const String&); 823 bool validateString(const char* functionName, const String&);
797 824
798 // Helper function to check target and texture bound to the target. 825 // Helper function to check target and texture bound to the target.
799 // Generate GL errors and return 0 if target is invalid or texture bound is 826 // Generate GL errors and return 0 if target is invalid or texture bound is
800 // null. Otherwise, return the texture bound to the target. 827 // null. Otherwise, return the texture bound to the target.
801 virtual WebGLTexture* validateTextureBinding(const char* functionName, GLenu m target, bool useSixEnumsForCubeMap); 828 virtual WebGLTexture* validateTextureBinding(const char* functionName, GLenu m target, bool useSixEnumsForCubeMap);
802 829
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 enum NullDisposition { 882 enum NullDisposition {
856 NullAllowed, 883 NullAllowed,
857 NullNotAllowed 884 NullNotAllowed
858 }; 885 };
859 886
860 // Helper function to validate that the given ArrayBufferView 887 // Helper function to validate that the given ArrayBufferView
861 // is of the correct type and contains enough data for the texImage call. 888 // is of the correct type and contains enough data for the texImage call.
862 // Generates GL error and returns false if parameters are invalid. 889 // Generates GL error and returns false if parameters are invalid.
863 bool validateTexFuncData(const char* functionName, GLint level, GLsizei widt h, GLsizei height, GLenum internalformat, GLenum format, GLenum type, DOMArrayBu fferView* pixels, NullDisposition); 890 bool validateTexFuncData(const char* functionName, GLint level, GLsizei widt h, GLsizei height, GLenum internalformat, GLenum format, GLenum type, DOMArrayBu fferView* pixels, NullDisposition);
864 891
892 // Helper function to validate that a copyTexSubImage call is valid.
893 bool validateCopyTexSubImage(const char* functionName, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei wi dth, GLsizei height);
894
865 // Helper function to validate a given texture format is settable as in 895 // Helper function to validate a given texture format is settable as in
866 // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and 896 // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and
867 // copyTexSubImage2D. 897 // copyTexSubImage2D.
868 // Generates GL error and returns false if the format is not settable. 898 // Generates GL error and returns false if the format is not settable.
869 bool validateSettableTexFormat(const char* functionName, GLenum format); 899 bool validateSettableTexFormat(const char* functionName, GLenum format);
870 900
871 // Helper function to validate compressed texture data is correct size 901 // Helper function to validate compressed texture data is correct size
872 // for the given format and dimensions. 902 // for the given format and dimensions.
873 bool validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* pixels); 903 bool validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* pixels);
874 904
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 static IntSize oldestContextSize(); 1069 static IntSize oldestContextSize();
1040 }; 1070 };
1041 1071
1042 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1072 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1043 1073
1044 } // namespace blink 1074 } // namespace blink
1045 1075
1046 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1076 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1047 1077
1048 #endif // WebGLRenderingContextBase_h 1078 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698