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

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

Issue 1205573003: WebGL 2: validate read buffer attachment when reading from FBO (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed zmo@'s and kbr@'s feedback, and rebased the code Created 5 years, 5 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 GLint m_maxViewportDims[2]; 563 GLint m_maxViewportDims[2];
564 GLint m_maxTextureLevel; 564 GLint m_maxTextureLevel;
565 GLint m_maxCubeMapTextureLevel; 565 GLint m_maxCubeMapTextureLevel;
566 566
567 GLint m_maxDrawBuffers; 567 GLint m_maxDrawBuffers;
568 GLint m_maxColorAttachments; 568 GLint m_maxColorAttachments;
569 GLenum m_backDrawBuffer; 569 GLenum m_backDrawBuffer;
570 bool m_drawBuffersWebGLRequirementsChecked; 570 bool m_drawBuffersWebGLRequirementsChecked;
571 bool m_drawBuffersSupported; 571 bool m_drawBuffersSupported;
572 572
573 GLenum m_readBufferOfDefaultFramebuffer;
574
573 GLint m_packAlignment; 575 GLint m_packAlignment;
574 GLint m_unpackAlignment; 576 GLint m_unpackAlignment;
575 bool m_unpackFlipY; 577 bool m_unpackFlipY;
576 bool m_unpackPremultiplyAlpha; 578 bool m_unpackPremultiplyAlpha;
577 GLenum m_unpackColorspaceConversion; 579 GLenum m_unpackColorspaceConversion;
578 WebGLContextAttributes m_requestedAttributes; 580 WebGLContextAttributes m_requestedAttributes;
579 581
580 GLfloat m_clearColor[4]; 582 GLfloat m_clearColor[4];
581 bool m_scissorEnabled; 583 bool m_scissorEnabled;
582 GLfloat m_clearDepth; 584 GLfloat m_clearDepth;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 bool validateCompressedTexFormat(GLenum format); 858 bool validateCompressedTexFormat(GLenum format);
857 859
858 // Helper function to validate compressed texture dimensions are valid for 860 // Helper function to validate compressed texture dimensions are valid for
859 // the given format. 861 // the given format.
860 bool validateCompressedTexDimensions(const char* functionName, TexImageFunct ionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum forma t); 862 bool validateCompressedTexDimensions(const char* functionName, TexImageFunct ionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum forma t);
861 863
862 // Helper function to validate compressed texture dimensions are valid for 864 // Helper function to validate compressed texture dimensions are valid for
863 // the given format. 865 // the given format.
864 bool validateCompressedTexSubDimensions(const char* functionName, GLenum tar get, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, G Lenum format, WebGLTexture*); 866 bool validateCompressedTexSubDimensions(const char* functionName, GLenum tar get, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, G Lenum format, WebGLTexture*);
865 867
868 // Helper function to validate that the image is attached to read buffer
869 // when reading from FBO (readPixels/copyTexImage2D/copyTexSubImage2D).
870 bool validateReadBufferAttachment(const char* functionName, const WebGLFrame buffer* readFramebufferBinding);
871
866 // Helper function to validate mode for draw{Arrays/Elements}. 872 // Helper function to validate mode for draw{Arrays/Elements}.
867 bool validateDrawMode(const char* functionName, GLenum); 873 bool validateDrawMode(const char* functionName, GLenum);
868 874
869 // Helper function to validate if front/back stencilMask and stencilFunc set tings are the same. 875 // Helper function to validate if front/back stencilMask and stencilFunc set tings are the same.
870 bool validateStencilSettings(const char* functionName); 876 bool validateStencilSettings(const char* functionName);
871 877
872 // Helper function to validate stencil or depth func. 878 // Helper function to validate stencil or depth func.
873 bool validateStencilOrDepthFunc(const char* functionName, GLenum); 879 bool validateStencilOrDepthFunc(const char* functionName, GLenum);
874 880
875 // Helper function for texParameterf and texParameteri. 881 // Helper function for texParameterf and texParameteri.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 static IntSize oldestContextSize(); 1022 static IntSize oldestContextSize();
1017 }; 1023 };
1018 1024
1019 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1025 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1020 1026
1021 } // namespace blink 1027 } // namespace blink
1022 1028
1023 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1029 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1024 1030
1025 #endif // WebGLRenderingContextBase_h 1031 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698