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

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

Issue 1684973002: Remove blink side texture status caching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 23 matching lines...) Expand all
34 class WebGLRenderbuffer; 34 class WebGLRenderbuffer;
35 class WebGLTexture; 35 class WebGLTexture;
36 36
37 class WebGLFramebuffer final : public WebGLContextObject { 37 class WebGLFramebuffer final : public WebGLContextObject {
38 DEFINE_WRAPPERTYPEINFO(); 38 DEFINE_WRAPPERTYPEINFO();
39 public: 39 public:
40 class WebGLAttachment : public GarbageCollectedFinalized<WebGLAttachment> { 40 class WebGLAttachment : public GarbageCollectedFinalized<WebGLAttachment> {
41 public: 41 public:
42 virtual ~WebGLAttachment(); 42 virtual ~WebGLAttachment();
43 43
44 virtual GLsizei width() const = 0;
45 virtual GLsizei height() const = 0;
46 virtual GLsizei depth() const = 0;
47 virtual GLenum format() const = 0;
48 // For texture attachment, type() returns the type of the attached textu re.
49 // For renderbuffer attachment, the type of the renderbuffer may vary wi th GL implementation.
50 // To avoid confusion, it would be better to not implement type() for re nderbuffer attachment and
51 // we should always use the internalformat of the renderbuffer and avoid using type() API.
52 virtual GLenum type() const = 0;
53 virtual bool isCubeComplete() const = 0;
54 virtual WebGLSharedObject* object() const = 0; 44 virtual WebGLSharedObject* object() const = 0;
55 virtual bool isSharedObject(WebGLSharedObject*) const = 0; 45 virtual bool isSharedObject(WebGLSharedObject*) const = 0;
56 virtual bool valid() const = 0; 46 virtual bool valid() const = 0;
57 virtual void onDetached(WebGraphicsContext3D*) = 0; 47 virtual void onDetached(WebGraphicsContext3D*) = 0;
58 virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachm ent) = 0; 48 virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachm ent) = 0;
59 virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attac hment) = 0; 49 virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attac hment) = 0;
60 50
61 DEFINE_INLINE_VIRTUAL_TRACE() { } 51 DEFINE_INLINE_VIRTUAL_TRACE() { }
62 52
63 protected: 53 protected:
64 WebGLAttachment(); 54 WebGLAttachment();
65 }; 55 };
66 56
67 ~WebGLFramebuffer() override; 57 ~WebGLFramebuffer() override;
68 58
69 static WebGLFramebuffer* create(WebGLRenderingContextBase*); 59 static WebGLFramebuffer* create(WebGLRenderingContextBase*);
70 60
71 Platform3DObject object() const { return m_object; } 61 Platform3DObject object() const { return m_object; }
72 62
73 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, GLen um texTarget, WebGLTexture*, GLint level, GLint layer); 63 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, GLen um texTarget, WebGLTexture*, GLint level, GLint layer);
74 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, WebG LRenderbuffer*); 64 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, WebG LRenderbuffer*);
75 // If an object is attached to the currently bound framebuffer, remove it. 65 // If an object is attached to the currently bound framebuffer, remove it.
76 void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*) ; 66 void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*) ;
77 // If a given attachment point for the currently bound framebuffer is not nu ll, remove the attached object. 67 // If a given attachment point for the currently bound framebuffer is not nu ll, remove the attached object.
78 void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment); 68 void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment);
79 WebGLSharedObject* getAttachmentObject(GLenum) const; 69 WebGLSharedObject* getAttachmentObject(GLenum) const;
80 70
81 GLenum colorBufferFormat() const;
82
83 // Software version of glCheckFramebufferStatus(), except that when
84 // FRAMEBUFFER_COMPLETE is returned, it is still possible for
85 // glCheckFramebufferStatus() to return FRAMEBUFFER_UNSUPPORTED,
86 // depending on hardware implementation.
87 GLenum checkStatus(const char** reason) const;
88
89 // WebGL 1 specific: 71 // WebGL 1 specific:
90 // 1) can't allow depth_stencil for depth/stencil attachments, and vice ve rsa. 72 // 1) can't allow depth_stencil for depth/stencil attachments, and vice ve rsa.
91 // 2) no conflicting DEPTH/STENCIL/DEPTH_STENCIL attachments. 73 // 2) no conflicting DEPTH/STENCIL/DEPTH_STENCIL attachments.
92 GLenum checkDepthStencilStatus(const char** reason) const; 74 GLenum checkDepthStencilStatus(const char** reason) const;
93 75
94 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } 76 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; }
95 77
96 void setHasEverBeenBound() { m_hasEverBeenBound = true; } 78 void setHasEverBeenBound() { m_hasEverBeenBound = true; }
97 79
98 bool hasStencilBuffer() const; 80 bool hasStencilBuffer() const;
99 81
100 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. 82 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug.
101 void drawBuffers(const Vector<GLenum>& bufs); 83 void drawBuffers(const Vector<GLenum>& bufs);
102 84
103 GLenum getDrawBuffer(GLenum); 85 GLenum getDrawBuffer(GLenum);
104 86
105 void readBuffer(const GLenum colorBuffer) { m_readBuffer = colorBuffer; } 87 void readBuffer(const GLenum colorBuffer) { m_readBuffer = colorBuffer; }
106 88
107 GLenum getReadBuffer() const { return m_readBuffer; } 89 GLenum getReadBuffer() const { return m_readBuffer; }
108 90
109 // If readbuffer is GL_NONE or no image is attached, return false.
110 // Note: it's ok for format or type to be nullptr.
111 bool getReadBufferFormatAndType(GLenum* format, GLenum* type) const;
112
113 DECLARE_VIRTUAL_TRACE(); 91 DECLARE_VIRTUAL_TRACE();
114 92
115 protected: 93 protected:
116 explicit WebGLFramebuffer(WebGLRenderingContextBase*); 94 explicit WebGLFramebuffer(WebGLRenderingContextBase*);
117 95
118 bool hasObject() const override { return m_object != 0; } 96 bool hasObject() const override { return m_object != 0; }
119 void deleteObjectImpl(WebGraphicsContext3D*) override; 97 void deleteObjectImpl(WebGraphicsContext3D*) override;
120 98
121 private: 99 private:
122 WebGLAttachment* getAttachment(GLenum attachment) const; 100 WebGLAttachment* getAttachment(GLenum attachment) const;
123 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment , const char** reason) const;
124 101
125 // Check if the framebuffer is currently bound. 102 // Check if the framebuffer is currently bound.
126 bool isBound(GLenum target) const; 103 bool isBound(GLenum target) const;
127 104
128 // attach 'attachment' at 'attachmentPoint'. 105 // attach 'attachment' at 'attachmentPoint'.
129 void attach(GLenum target, GLenum attachment, GLenum attachmentPoint); 106 void attach(GLenum target, GLenum attachment, GLenum attachmentPoint);
130 107
131 // Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment. 108 // Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment.
132 void drawBuffersIfNecessary(bool force); 109 void drawBuffersIfNecessary(bool force);
133 110
134 Platform3DObject m_object; 111 Platform3DObject m_object;
135 112
136 typedef HeapHashMap<GLenum, Member<WebGLAttachment>> AttachmentMap; 113 typedef HeapHashMap<GLenum, Member<WebGLAttachment>> AttachmentMap;
137 114
138 AttachmentMap m_attachments; 115 AttachmentMap m_attachments;
139 bool m_destructionInProgress; 116 bool m_destructionInProgress;
140 117
141 bool m_hasEverBeenBound; 118 bool m_hasEverBeenBound;
142 119
143 Vector<GLenum> m_drawBuffers; 120 Vector<GLenum> m_drawBuffers;
144 Vector<GLenum> m_filteredDrawBuffers; 121 Vector<GLenum> m_filteredDrawBuffers;
145 122
146 GLenum m_readBuffer; 123 GLenum m_readBuffer;
147 }; 124 };
148 125
149 } // namespace blink 126 } // namespace blink
150 127
151 #endif // WebGLFramebuffer_h 128 #endif // WebGLFramebuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698