| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual void onDetached(blink::WebGraphicsContext3D*) = 0; | 57 virtual void onDetached(blink::WebGraphicsContext3D*) = 0; |
| 58 virtual void attach(blink::WebGraphicsContext3D*, GLenum attachment) = 0
; | 58 virtual void attach(blink::WebGraphicsContext3D*, GLenum attachment) = 0
; |
| 59 virtual void unattach(blink::WebGraphicsContext3D*, GLenum attachment) =
0; | 59 virtual void unattach(blink::WebGraphicsContext3D*, GLenum attachment) =
0; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 WebGLAttachment(); | 62 WebGLAttachment(); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 virtual ~WebGLFramebuffer(); | 65 virtual ~WebGLFramebuffer(); |
| 66 | 66 |
| 67 static PassRefPtr<WebGLFramebuffer> create(WebGLRenderingContext*); | 67 static PassRefPtr<WebGLFramebuffer> create(WebGLRenderingContextBase*); |
| 68 | 68 |
| 69 void setAttachmentForBoundFramebuffer(GLenum attachment, GLenum texTarget, W
ebGLTexture*, GLint level); | 69 void setAttachmentForBoundFramebuffer(GLenum attachment, GLenum texTarget, W
ebGLTexture*, GLint level); |
| 70 void setAttachmentForBoundFramebuffer(GLenum attachment, WebGLRenderbuffer*)
; | 70 void setAttachmentForBoundFramebuffer(GLenum attachment, WebGLRenderbuffer*)
; |
| 71 // If an object is attached to the currently bound framebuffer, remove it. | 71 // If an object is attached to the currently bound framebuffer, remove it. |
| 72 void removeAttachmentFromBoundFramebuffer(WebGLSharedObject*); | 72 void removeAttachmentFromBoundFramebuffer(WebGLSharedObject*); |
| 73 // If a given attachment point for the currently bound framebuffer is not nu
ll, remove the attached object. | 73 // If a given attachment point for the currently bound framebuffer is not nu
ll, remove the attached object. |
| 74 void removeAttachmentFromBoundFramebuffer(GLenum); | 74 void removeAttachmentFromBoundFramebuffer(GLenum); |
| 75 WebGLSharedObject* getAttachmentObject(GLenum) const; | 75 WebGLSharedObject* getAttachmentObject(GLenum) const; |
| 76 | 76 |
| 77 GLenum colorBufferFormat() const; | 77 GLenum colorBufferFormat() const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 void setHasEverBeenBound() { m_hasEverBeenBound = true; } | 95 void setHasEverBeenBound() { m_hasEverBeenBound = true; } |
| 96 | 96 |
| 97 bool hasStencilBuffer() const; | 97 bool hasStencilBuffer() const; |
| 98 | 98 |
| 99 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. | 99 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. |
| 100 void drawBuffers(const Vector<GLenum>& bufs); | 100 void drawBuffers(const Vector<GLenum>& bufs); |
| 101 | 101 |
| 102 GLenum getDrawBuffer(GLenum); | 102 GLenum getDrawBuffer(GLenum); |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 WebGLFramebuffer(WebGLRenderingContext*); | 105 WebGLFramebuffer(WebGLRenderingContextBase*); |
| 106 | 106 |
| 107 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) OVERRIDE; | 107 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) OVERRIDE; |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 WebGLAttachment* getAttachment(GLenum) const; | 110 WebGLAttachment* getAttachment(GLenum) const; |
| 111 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment
, const char** reason) const; | 111 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment
, const char** reason) const; |
| 112 | 112 |
| 113 // Check if the framebuffer is currently bound. | 113 // Check if the framebuffer is currently bound. |
| 114 bool isBound() const; | 114 bool isBound() const; |
| 115 | 115 |
| 116 // attach 'attachment' at 'attachmentPoint'. | 116 // attach 'attachment' at 'attachmentPoint'. |
| 117 void attach(GLenum attachment, GLenum attachmentPoint); | 117 void attach(GLenum attachment, GLenum attachmentPoint); |
| 118 | 118 |
| 119 // Check if a new drawBuffers call should be issued. This is called when we
add or remove an attachment. | 119 // Check if a new drawBuffers call should be issued. This is called when we
add or remove an attachment. |
| 120 void drawBuffersIfNecessary(bool force); | 120 void drawBuffersIfNecessary(bool force); |
| 121 | 121 |
| 122 typedef WTF::HashMap<GLenum, RefPtr<WebGLAttachment> > AttachmentMap; | 122 typedef WTF::HashMap<GLenum, RefPtr<WebGLAttachment> > AttachmentMap; |
| 123 | 123 |
| 124 AttachmentMap m_attachments; | 124 AttachmentMap m_attachments; |
| 125 | 125 |
| 126 bool m_hasEverBeenBound; | 126 bool m_hasEverBeenBound; |
| 127 | 127 |
| 128 Vector<GLenum> m_drawBuffers; | 128 Vector<GLenum> m_drawBuffers; |
| 129 Vector<GLenum> m_filteredDrawBuffers; | 129 Vector<GLenum> m_filteredDrawBuffers; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace WebCore | 132 } // namespace WebCore |
| 133 | 133 |
| 134 #endif // WebGLFramebuffer_h | 134 #endif // WebGLFramebuffer_h |
| OLD | NEW |