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

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

Issue 2025703002: Pack repeated code in tex(Sub)Image2D and texSubImage3D into helper func (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make validateTexture3DBinding pure virtual in WebGLBase Created 4 years, 6 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 Member<WebGLTexture> m_texture2DBinding; 405 Member<WebGLTexture> m_texture2DBinding;
406 Member<WebGLTexture> m_textureCubeMapBinding; 406 Member<WebGLTexture> m_textureCubeMapBinding;
407 Member<WebGLTexture> m_texture3DBinding; 407 Member<WebGLTexture> m_texture3DBinding;
408 Member<WebGLTexture> m_texture2DArrayBinding; 408 Member<WebGLTexture> m_texture2DArrayBinding;
409 409
410 DECLARE_TRACE(); 410 DECLARE_TRACE();
411 }; 411 };
412 412
413 void setFilterQuality(SkFilterQuality) override; 413 void setFilterQuality(SkFilterQuality) override;
414 bool isWebGL2OrHigher() { return version() >= 2; } 414 bool isWebGL2OrHigher() { return version() >= 2; }
415 virtual WebGLTexture* validateTexture3DBinding(const char* functionName, GLe num target) = 0;
415 416
416 protected: 417 protected:
417 friend class EXTDisjointTimerQuery; 418 friend class EXTDisjointTimerQuery;
418 friend class WebGLDrawBuffers; 419 friend class WebGLDrawBuffers;
419 friend class WebGLFramebuffer; 420 friend class WebGLFramebuffer;
420 friend class WebGLObject; 421 friend class WebGLObject;
421 friend class WebGLContextObject; 422 friend class WebGLContextObject;
422 friend class OESVertexArrayObject; 423 friend class OESVertexArrayObject;
423 friend class WebGLDebugShaders; 424 friend class WebGLDebugShaders;
424 friend class WebGLCompressedTextureASTC; 425 friend class WebGLCompressedTextureASTC;
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 static void willDestroyContext(WebGLRenderingContextBase*); 1082 static void willDestroyContext(WebGLRenderingContextBase*);
1082 static void forciblyLoseOldestContext(const String& reason); 1083 static void forciblyLoseOldestContext(const String& reason);
1083 // Return the least recently used context's position in the active context v ector. 1084 // Return the least recently used context's position in the active context v ector.
1084 // If the vector is empty, return the maximum allowed active context number. 1085 // If the vector is empty, return the maximum allowed active context number.
1085 static WebGLRenderingContextBase* oldestContext(); 1086 static WebGLRenderingContextBase* oldestContext();
1086 static WebGLRenderingContextBase* oldestEvictedContext(); 1087 static WebGLRenderingContextBase* oldestEvictedContext();
1087 1088
1088 CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakTh isPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextB ase>(this); } 1089 CrossThreadWeakPersistentThisPointer<WebGLRenderingContextBase> createWeakTh isPointer() { return CrossThreadWeakPersistentThisPointer<WebGLRenderingContextB ase>(this); }
1089 1090
1090 ImageBitmap* transferToImageBitmapBase(); 1091 ImageBitmap* transferToImageBitmapBase();
1092
1093 // Helper functions for tex(Sub)Image2D && texSubImage3D
1094 void texImageHelperDOMArrayBufferView(const char*, GLenum, GLint, GLint, GLs izei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMArrayBuff erView*);
1095 void texImageHelperImageData(const char*, GLenum, GLint, GLint, GLint, GLenu m, GLenum, GLsizei, GLint, GLint, GLint, ImageData*);
1096 bool texImageHelperHTMLImageElement(const char*, GLenum, GLint, GLint, GLenu m, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&);
1097 WebGLTexture* texImageHelperHTMLCanvasElement(const char*, GLenum, GLint, GL int, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&);
1098 WebGLTexture* texImageHelperHTMLVideoElement(const char*, GLenum, GLint, GLi nt, GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&);
1099 void texImageHelperImageBitmap(const char*, GLenum, GLint, GLint, GLenum, GL enum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&);
1100
1091 private: 1101 private:
1092 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&); 1102 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<W ebGraphicsContext3DProvider>, const WebGLContextAttributes&);
1093 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); 1103 static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInterna l(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned);
1094 }; 1104 };
1095 1105
1096 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); 1106 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d());
1097 1107
1098 } // namespace blink 1108 } // namespace blink
1099 1109
1100 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); 1110 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState);
1101 1111
1102 #endif // WebGLRenderingContextBase_h 1112 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698