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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ~WebGLFramebuffer() override; | 63 ~WebGLFramebuffer() override; |
64 | 64 |
65 static WebGLFramebuffer* create(WebGLRenderingContextBase*); | 65 static WebGLFramebuffer* create(WebGLRenderingContextBase*); |
66 | 66 |
67 GLuint object() const { return m_object; } | 67 GLuint object() const { return m_object; } |
68 | 68 |
69 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, GLen
um texTarget, WebGLTexture*, GLint level, GLint layer); | 69 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, GLen
um texTarget, WebGLTexture*, GLint level, GLint layer); |
70 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, WebG
LRenderbuffer*); | 70 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, WebG
LRenderbuffer*); |
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(GLenum target, WebGLSharedObject*)
; | 72 void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*)
; |
73 // If a given attachment point for the currently bound framebuffer is not nu
ll, remove the attached object. | |
74 void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment); | |
75 WebGLSharedObject* getAttachmentObject(GLenum) const; | 73 WebGLSharedObject* getAttachmentObject(GLenum) const; |
76 | 74 |
77 // WebGL 1 specific: | 75 // WebGL 1 specific: |
78 // 1) can't allow depth_stencil for depth/stencil attachments, and vice ve
rsa. | 76 // 1) can't allow depth_stencil for depth/stencil attachments, and vice ve
rsa. |
79 // 2) no conflicting DEPTH/STENCIL/DEPTH_STENCIL attachments. | 77 // 2) no conflicting DEPTH/STENCIL/DEPTH_STENCIL attachments. |
80 GLenum checkDepthStencilStatus(const char** reason) const; | 78 GLenum checkDepthStencilStatus(const char** reason) const; |
81 | 79 |
82 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } | 80 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } |
83 | 81 |
84 void setHasEverBeenBound() { m_hasEverBeenBound = true; } | 82 void setHasEverBeenBound() { m_hasEverBeenBound = true; } |
(...skipping 18 matching lines...) Expand all Loading... |
103 | 101 |
104 bool hasObject() const override { return m_object != 0; } | 102 bool hasObject() const override { return m_object != 0; } |
105 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; | 103 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; |
106 | 104 |
107 private: | 105 private: |
108 WebGLAttachment* getAttachment(GLenum attachment) const; | 106 WebGLAttachment* getAttachment(GLenum attachment) const; |
109 | 107 |
110 // Check if the framebuffer is currently bound. | 108 // Check if the framebuffer is currently bound. |
111 bool isBound(GLenum target) const; | 109 bool isBound(GLenum target) const; |
112 | 110 |
113 // attach 'attachment' at 'attachmentPoint'. | |
114 void attach(GLenum target, GLenum attachment, GLenum attachmentPoint); | |
115 | |
116 // Check if a new drawBuffers call should be issued. This is called when we
add or remove an attachment. | 111 // Check if a new drawBuffers call should be issued. This is called when we
add or remove an attachment. |
117 void drawBuffersIfNecessary(bool force); | 112 void drawBuffersIfNecessary(bool force); |
118 | 113 |
| 114 void setAttachmentInternal(GLenum target, GLenum attachment, GLenum texTarge
t, WebGLTexture*, GLint level, GLint layer); |
| 115 void setAttachmentInternal(GLenum target, GLenum attachment, WebGLRenderbuff
er*); |
| 116 // If a given attachment point for the currently bound framebuffer is not nu
ll, remove the attached object. |
| 117 void removeAttachmentInternal(GLenum target, GLenum attachment); |
| 118 |
| 119 void commitWebGL1DepthStencilIfConsistent(GLenum target); |
| 120 |
119 GLuint m_object; | 121 GLuint m_object; |
120 | 122 |
121 typedef HeapHashMap<GLenum, Member<WebGLAttachment>> AttachmentMap; | 123 typedef HeapHashMap<GLenum, Member<WebGLAttachment>> AttachmentMap; |
122 | 124 |
123 AttachmentMap m_attachments; | 125 AttachmentMap m_attachments; |
124 bool m_destructionInProgress; | 126 bool m_destructionInProgress; |
125 | 127 |
126 bool m_hasEverBeenBound; | 128 bool m_hasEverBeenBound; |
| 129 bool m_webGL1DepthStencilConsistent; |
127 | 130 |
128 Vector<GLenum> m_drawBuffers; | 131 Vector<GLenum> m_drawBuffers; |
129 Vector<GLenum> m_filteredDrawBuffers; | 132 Vector<GLenum> m_filteredDrawBuffers; |
130 | 133 |
131 GLenum m_readBuffer; | 134 GLenum m_readBuffer; |
132 }; | 135 }; |
133 | 136 |
134 } // namespace blink | 137 } // namespace blink |
135 | 138 |
136 #endif // WebGLFramebuffer_h | 139 #endif // WebGLFramebuffer_h |
OLD | NEW |