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

Side by Side Diff: Source/modules/webgl/WebGLFramebuffer.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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 void setHasEverBeenBound() { m_hasEverBeenBound = true; } 97 void setHasEverBeenBound() { m_hasEverBeenBound = true; }
98 98
99 bool hasStencilBuffer() const; 99 bool hasStencilBuffer() const;
100 100
101 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. 101 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug.
102 void drawBuffers(const Vector<GLenum>& bufs); 102 void drawBuffers(const Vector<GLenum>& bufs);
103 103
104 GLenum getDrawBuffer(GLenum); 104 GLenum getDrawBuffer(GLenum);
105 105
106 void readBuffer(const GLenum colorBuffer) { m_readBuffer = colorBuffer; }
107
108 GLenum getReadBuffer() const { return m_readBuffer; }
109
106 DECLARE_VIRTUAL_TRACE(); 110 DECLARE_VIRTUAL_TRACE();
107 111
108 protected: 112 protected:
109 explicit WebGLFramebuffer(WebGLRenderingContextBase*); 113 explicit WebGLFramebuffer(WebGLRenderingContextBase*);
110 114
111 bool hasObject() const override { return m_object != 0; } 115 bool hasObject() const override { return m_object != 0; }
112 void deleteObjectImpl(WebGraphicsContext3D*) override; 116 void deleteObjectImpl(WebGraphicsContext3D*) override;
113 117
114 private: 118 private:
115 WebGLAttachment* getAttachment(GLenum attachment) const; 119 WebGLAttachment* getAttachment(GLenum attachment) const;
(...skipping 11 matching lines...) Expand all
127 Platform3DObject m_object; 131 Platform3DObject m_object;
128 132
129 typedef WillBeHeapHashMap<GLenum, RefPtrWillBeMember<WebGLAttachment>> Attac hmentMap; 133 typedef WillBeHeapHashMap<GLenum, RefPtrWillBeMember<WebGLAttachment>> Attac hmentMap;
130 134
131 AttachmentMap m_attachments; 135 AttachmentMap m_attachments;
132 136
133 bool m_hasEverBeenBound; 137 bool m_hasEverBeenBound;
134 138
135 Vector<GLenum> m_drawBuffers; 139 Vector<GLenum> m_drawBuffers;
136 Vector<GLenum> m_filteredDrawBuffers; 140 Vector<GLenum> m_filteredDrawBuffers;
141
142 GLenum m_readBuffer;
137 }; 143 };
138 144
139 } // namespace blink 145 } // namespace blink
140 146
141 #endif // WebGLFramebuffer_h 147 #endif // WebGLFramebuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698