| 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 22 matching lines...) Expand all Loading... |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 class WebGLRenderbufferAttachment final | 37 class WebGLRenderbufferAttachment final |
| 38 : public WebGLFramebuffer::WebGLAttachment { | 38 : public WebGLFramebuffer::WebGLAttachment { |
| 39 public: | 39 public: |
| 40 static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*); | 40 static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*); |
| 41 | 41 |
| 42 DECLARE_VIRTUAL_TRACE(); | 42 DECLARE_VIRTUAL_TRACE(); |
| 43 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { | |
| 44 visitor->traceWrappers(m_renderbuffer); | |
| 45 } | |
| 46 | 43 |
| 47 private: | 44 private: |
| 48 explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); | 45 explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); |
| 49 WebGLRenderbufferAttachment() : m_renderbuffer(this, nullptr) {} | 46 WebGLRenderbufferAttachment() {} |
| 50 | 47 |
| 51 WebGLSharedObject* object() const override; | 48 WebGLSharedObject* object() const override; |
| 52 bool isSharedObject(WebGLSharedObject*) const override; | 49 bool isSharedObject(WebGLSharedObject*) const override; |
| 53 bool valid() const override; | 50 bool valid() const override; |
| 54 void onDetached(gpu::gles2::GLES2Interface*) override; | 51 void onDetached(gpu::gles2::GLES2Interface*) override; |
| 55 void attach(gpu::gles2::GLES2Interface*, | 52 void attach(gpu::gles2::GLES2Interface*, |
| 56 GLenum target, | 53 GLenum target, |
| 57 GLenum attachment) override; | 54 GLenum attachment) override; |
| 58 void unattach(gpu::gles2::GLES2Interface*, | 55 void unattach(gpu::gles2::GLES2Interface*, |
| 59 GLenum target, | 56 GLenum target, |
| 60 GLenum attachment) override; | 57 GLenum attachment) override; |
| 61 | 58 |
| 62 TraceWrapperMember<WebGLRenderbuffer> m_renderbuffer; | 59 Member<WebGLRenderbuffer> m_renderbuffer; |
| 63 }; | 60 }; |
| 64 | 61 |
| 65 WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create( | 62 WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create( |
| 66 WebGLRenderbuffer* renderbuffer) { | 63 WebGLRenderbuffer* renderbuffer) { |
| 67 return new WebGLRenderbufferAttachment(renderbuffer); | 64 return new WebGLRenderbufferAttachment(renderbuffer); |
| 68 } | 65 } |
| 69 | 66 |
| 70 DEFINE_TRACE(WebGLRenderbufferAttachment) { | 67 DEFINE_TRACE(WebGLRenderbufferAttachment) { |
| 71 visitor->trace(m_renderbuffer); | 68 visitor->trace(m_renderbuffer); |
| 72 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 69 WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| 73 } | 70 } |
| 74 | 71 |
| 75 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment( | 72 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment( |
| 76 WebGLRenderbuffer* renderbuffer) | 73 WebGLRenderbuffer* renderbuffer) |
| 77 : m_renderbuffer(this, renderbuffer) {} | 74 : m_renderbuffer(renderbuffer) {} |
| 78 | 75 |
| 79 WebGLSharedObject* WebGLRenderbufferAttachment::object() const { | 76 WebGLSharedObject* WebGLRenderbufferAttachment::object() const { |
| 80 return m_renderbuffer->object() ? m_renderbuffer.get() : 0; | 77 return m_renderbuffer->object() ? m_renderbuffer.get() : 0; |
| 81 } | 78 } |
| 82 | 79 |
| 83 bool WebGLRenderbufferAttachment::isSharedObject( | 80 bool WebGLRenderbufferAttachment::isSharedObject( |
| 84 WebGLSharedObject* object) const { | 81 WebGLSharedObject* object) const { |
| 85 return object == m_renderbuffer; | 82 return object == m_renderbuffer; |
| 86 } | 83 } |
| 87 | 84 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 107 } | 104 } |
| 108 | 105 |
| 109 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { | 106 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| 110 public: | 107 public: |
| 111 static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, | 108 static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, |
| 112 GLenum target, | 109 GLenum target, |
| 113 GLint level, | 110 GLint level, |
| 114 GLint layer); | 111 GLint layer); |
| 115 | 112 |
| 116 DECLARE_VIRTUAL_TRACE(); | 113 DECLARE_VIRTUAL_TRACE(); |
| 117 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { visitor->traceWrappers(m_texture); } | |
| 118 | 114 |
| 119 private: | 115 private: |
| 120 WebGLTextureAttachment(WebGLTexture*, | 116 WebGLTextureAttachment(WebGLTexture*, |
| 121 GLenum target, | 117 GLenum target, |
| 122 GLint level, | 118 GLint level, |
| 123 GLint layer); | 119 GLint layer); |
| 124 WebGLTextureAttachment() : m_texture(this, nullptr) {} | 120 WebGLTextureAttachment() {} |
| 125 | 121 |
| 126 WebGLSharedObject* object() const override; | 122 WebGLSharedObject* object() const override; |
| 127 bool isSharedObject(WebGLSharedObject*) const override; | 123 bool isSharedObject(WebGLSharedObject*) const override; |
| 128 bool valid() const override; | 124 bool valid() const override; |
| 129 void onDetached(gpu::gles2::GLES2Interface*) override; | 125 void onDetached(gpu::gles2::GLES2Interface*) override; |
| 130 void attach(gpu::gles2::GLES2Interface*, | 126 void attach(gpu::gles2::GLES2Interface*, |
| 131 GLenum target, | 127 GLenum target, |
| 132 GLenum attachment) override; | 128 GLenum attachment) override; |
| 133 void unattach(gpu::gles2::GLES2Interface*, | 129 void unattach(gpu::gles2::GLES2Interface*, |
| 134 GLenum target, | 130 GLenum target, |
| 135 GLenum attachment) override; | 131 GLenum attachment) override; |
| 136 | 132 |
| 137 TraceWrapperMember<WebGLTexture> m_texture; | 133 Member<WebGLTexture> m_texture; |
| 138 GLenum m_target; | 134 GLenum m_target; |
| 139 GLint m_level; | 135 GLint m_level; |
| 140 GLint m_layer; | 136 GLint m_layer; |
| 141 }; | 137 }; |
| 142 | 138 |
| 143 WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create( | 139 WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create( |
| 144 WebGLTexture* texture, | 140 WebGLTexture* texture, |
| 145 GLenum target, | 141 GLenum target, |
| 146 GLint level, | 142 GLint level, |
| 147 GLint layer) { | 143 GLint layer) { |
| 148 return new WebGLTextureAttachment(texture, target, level, layer); | 144 return new WebGLTextureAttachment(texture, target, level, layer); |
| 149 } | 145 } |
| 150 | 146 |
| 151 DEFINE_TRACE(WebGLTextureAttachment) { | 147 DEFINE_TRACE(WebGLTextureAttachment) { |
| 152 visitor->trace(m_texture); | 148 visitor->trace(m_texture); |
| 153 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 149 WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| 154 } | 150 } |
| 155 | 151 |
| 156 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, | 152 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, |
| 157 GLenum target, | 153 GLenum target, |
| 158 GLint level, | 154 GLint level, |
| 159 GLint layer) | 155 GLint layer) |
| 160 : m_texture(this, texture), | 156 : m_texture(texture), m_target(target), m_level(level), m_layer(layer) {} |
| 161 m_target(target), | |
| 162 m_level(level), | |
| 163 m_layer(layer) {} | |
| 164 | 157 |
| 165 WebGLSharedObject* WebGLTextureAttachment::object() const { | 158 WebGLSharedObject* WebGLTextureAttachment::object() const { |
| 166 return m_texture->object() ? m_texture.get() : 0; | 159 return m_texture->object() ? m_texture.get() : 0; |
| 167 } | 160 } |
| 168 | 161 |
| 169 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const { | 162 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const { |
| 170 return object == m_texture; | 163 return object == m_texture; |
| 171 } | 164 } |
| 172 | 165 |
| 173 bool WebGLTextureAttachment::valid() const { | 166 bool WebGLTextureAttachment::valid() const { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 } | 550 } |
| 558 | 551 |
| 559 DEFINE_TRACE_WRAPPERS(WebGLFramebuffer) { | 552 DEFINE_TRACE_WRAPPERS(WebGLFramebuffer) { |
| 560 for (const auto& attachment : m_attachments) { | 553 for (const auto& attachment : m_attachments) { |
| 561 visitor->traceWrappers(attachment.value->object()); | 554 visitor->traceWrappers(attachment.value->object()); |
| 562 } | 555 } |
| 563 WebGLContextObject::traceWrappers(visitor); | 556 WebGLContextObject::traceWrappers(visitor); |
| 564 } | 557 } |
| 565 | 558 |
| 566 } // namespace blink | 559 } // namespace blink |
| OLD | NEW |