| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 #include "modules/webgl/WebGLRenderbuffer.h" | 30 #include "modules/webgl/WebGLRenderbuffer.h" |
| 31 #include "modules/webgl/WebGLRenderingContextBase.h" | 31 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 32 #include "modules/webgl/WebGLTexture.h" | 32 #include "modules/webgl/WebGLTexture.h" |
| 33 #include "platform/NotImplemented.h" | 33 #include "platform/NotImplemented.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAtta
chment { | 39 class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachme
nt { |
| 40 public: | 40 public: |
| 41 static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(
WebGLRenderbuffer*); | 41 static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebG
LRenderbuffer*); |
| 42 | 42 |
| 43 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); | 46 explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); |
| 47 WebGLRenderbufferAttachment() { } | 47 WebGLRenderbufferAttachment() { } |
| 48 | 48 |
| 49 GLsizei width() const override; | 49 GLsizei width() const override; |
| 50 GLsizei height() const override; | 50 GLsizei height() const override; |
| 51 GLenum format() const override; | 51 GLenum format() const override; |
| 52 GLenum type() const override; | 52 GLenum type() const override; |
| 53 WebGLSharedObject* object() const override; | 53 WebGLSharedObject* object() const override; |
| 54 bool isSharedObject(WebGLSharedObject*) const override; | 54 bool isSharedObject(WebGLSharedObject*) const override; |
| 55 bool valid() const override; | 55 bool valid() const override; |
| 56 void onDetached(WebGraphicsContext3D*) override; | 56 void onDetached(WebGraphicsContext3D*) override; |
| 57 void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) ove
rride; | 57 void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) overrid
e; |
| 58 void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) o
verride; | 58 void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) overr
ide; |
| 59 | 59 |
| 60 RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer; | 60 RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferA
ttachment::create(WebGLRenderbuffer* renderbuffer) | 63 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttac
hment::create(WebGLRenderbuffer* renderbuffer) |
| 64 { | 64 { |
| 65 return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer))
; | 65 return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 DEFINE_TRACE(WebGLRenderbufferAttachment) | 68 DEFINE_TRACE(WebGLRenderbufferAttachment) |
| 69 { | 69 { |
| 70 visitor->trace(m_renderbuffer); | 70 visitor->trace(m_renderbuffer); |
| 71 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 71 WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| 72 } | 72 } |
| 73 | 73 |
| 74 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer*
renderbuffer) | 74 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer* rend
erbuffer) |
| 75 : m_renderbuffer(renderbuffer) | 75 : m_renderbuffer(renderbuffer) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 GLsizei WebGLRenderbufferAttachment::width() const | 79 GLsizei WebGLRenderbufferAttachment::width() const |
| 80 { | 80 { |
| 81 return m_renderbuffer->width(); | 81 return m_renderbuffer->width(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 GLsizei WebGLRenderbufferAttachment::height() const | 84 GLsizei WebGLRenderbufferAttachment::height() const |
| 85 { | 85 { |
| 86 return m_renderbuffer->height(); | 86 return m_renderbuffer->height(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 GLenum WebGLRenderbufferAttachment::format() const | 89 GLenum WebGLRenderbufferAttachment::format() const |
| 90 { | 90 { |
| 91 GLenum format = m_renderbuffer->internalFormat(); | 91 GLenum format = m_renderbuffer->internalFormat(); |
| 92 if (format == GL_DEPTH_STENCIL_OES | 92 if (format == GL_DEPTH_STENCIL_OES |
| 93 && m_renderbuffer->emulatedStencilBuffer() | 93 && m_renderbuffer->emulatedStencilBuffer() |
| 94 && m_renderbuffer->emulatedStencilBuffer()->internalFormat() != GL_S
TENCIL_INDEX8) { | 94 && m_renderbuffer->emulatedStencilBuffer()->internalFormat() != GL_STENC
IL_INDEX8) { |
| 95 return 0; | |
| 96 } | |
| 97 return format; | |
| 98 } | |
| 99 | |
| 100 WebGLSharedObject* WebGLRenderbufferAttachment::object() const | |
| 101 { | |
| 102 return m_renderbuffer->object() ? m_renderbuffer.get() : 0; | |
| 103 } | |
| 104 | |
| 105 bool WebGLRenderbufferAttachment::isSharedObject(WebGLSharedObject* object)
const | |
| 106 { | |
| 107 return object == m_renderbuffer; | |
| 108 } | |
| 109 | |
| 110 bool WebGLRenderbufferAttachment::valid() const | |
| 111 { | |
| 112 return m_renderbuffer->object(); | |
| 113 } | |
| 114 | |
| 115 void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context) | |
| 116 { | |
| 117 m_renderbuffer->onDetached(context); | |
| 118 } | |
| 119 | |
| 120 void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLen
um target, GLenum attachment) | |
| 121 { | |
| 122 Platform3DObject object = objectOrZero(m_renderbuffer.get()); | |
| 123 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulate
dStencilBuffer()) { | |
| 124 context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_REN
DERBUFFER, object); | |
| 125 context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_R
ENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer())); | |
| 126 } else { | |
| 127 context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER
, object); | |
| 128 } | |
| 129 } | |
| 130 | |
| 131 void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GL
enum target, GLenum attachment) | |
| 132 { | |
| 133 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | |
| 134 context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_REN
DERBUFFER, 0); | |
| 135 context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_R
ENDERBUFFER, 0); | |
| 136 } else { | |
| 137 context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER
, 0); | |
| 138 } | |
| 139 } | |
| 140 | |
| 141 GLenum WebGLRenderbufferAttachment::type() const | |
| 142 { | |
| 143 return 0; | 95 return 0; |
| 144 } | 96 } |
| 145 | 97 return format; |
| 146 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachmen
t { | 98 } |
| 147 public: | 99 |
| 148 static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(
WebGLTexture*, GLenum target, GLint level); | 100 WebGLSharedObject* WebGLRenderbufferAttachment::object() const |
| 149 | 101 { |
| 150 DECLARE_VIRTUAL_TRACE(); | 102 return m_renderbuffer->object() ? m_renderbuffer.get() : 0; |
| 151 | 103 } |
| 152 private: | 104 |
| 153 WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level); | 105 bool WebGLRenderbufferAttachment::isSharedObject(WebGLSharedObject* object) cons
t |
| 154 WebGLTextureAttachment() { } | 106 { |
| 155 | 107 return object == m_renderbuffer; |
| 156 GLsizei width() const override; | 108 } |
| 157 GLsizei height() const override; | 109 |
| 158 GLenum format() const override; | 110 bool WebGLRenderbufferAttachment::valid() const |
| 159 GLenum type() const override; | 111 { |
| 160 WebGLSharedObject* object() const override; | 112 return m_renderbuffer->object(); |
| 161 bool isSharedObject(WebGLSharedObject*) const override; | 113 } |
| 162 bool valid() const override; | 114 |
| 163 void onDetached(WebGraphicsContext3D*) override; | 115 void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context) |
| 164 void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) ove
rride; | 116 { |
| 165 void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) o
verride; | 117 m_renderbuffer->onDetached(context); |
| 166 | 118 } |
| 167 RefPtrWillBeMember<WebGLTexture> m_texture; | 119 |
| 168 GLenum m_target; | 120 void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLenum t
arget, GLenum attachment) |
| 169 GLint m_level; | 121 { |
| 170 }; | 122 Platform3DObject object = objectOrZero(m_renderbuffer.get()); |
| 171 | 123 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulatedSte
ncilBuffer()) { |
| 172 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttach
ment::create(WebGLTexture* texture, GLenum target, GLint level) | 124 context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERB
UFFER, object); |
| 173 { | 125 context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDE
RBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer())); |
| 174 return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, le
vel)); | 126 } else { |
| 175 } | 127 context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, ob
ject); |
| 176 | 128 } |
| 177 DEFINE_TRACE(WebGLTextureAttachment) | 129 } |
| 178 { | 130 |
| 179 visitor->trace(m_texture); | 131 void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum
target, GLenum attachment) |
| 180 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 132 { |
| 181 } | 133 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 182 | 134 context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERB
UFFER, 0); |
| 183 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GLenum
target, GLint level) | 135 context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDE
RBUFFER, 0); |
| 184 : m_texture(texture) | 136 } else { |
| 185 , m_target(target) | 137 context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0)
; |
| 186 , m_level(level) | 138 } |
| 187 { | 139 } |
| 188 } | 140 |
| 189 | 141 GLenum WebGLRenderbufferAttachment::type() const |
| 190 GLsizei WebGLTextureAttachment::width() const | 142 { |
| 191 { | 143 return 0; |
| 192 return m_texture->getWidth(m_target, m_level); | 144 } |
| 193 } | 145 |
| 194 | 146 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| 195 GLsizei WebGLTextureAttachment::height() const | 147 public: |
| 196 { | 148 static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebG
LTexture*, GLenum target, GLint level); |
| 197 return m_texture->getHeight(m_target, m_level); | 149 |
| 198 } | 150 DECLARE_VIRTUAL_TRACE(); |
| 199 | 151 |
| 200 GLenum WebGLTextureAttachment::format() const | 152 private: |
| 201 { | 153 WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level); |
| 202 return m_texture->getInternalFormat(m_target, m_level); | 154 WebGLTextureAttachment() { } |
| 203 } | 155 |
| 204 | 156 GLsizei width() const override; |
| 205 WebGLSharedObject* WebGLTextureAttachment::object() const | 157 GLsizei height() const override; |
| 206 { | 158 GLenum format() const override; |
| 207 return m_texture->object() ? m_texture.get() : 0; | 159 GLenum type() const override; |
| 208 } | 160 WebGLSharedObject* object() const override; |
| 209 | 161 bool isSharedObject(WebGLSharedObject*) const override; |
| 210 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const | 162 bool valid() const override; |
| 211 { | 163 void onDetached(WebGraphicsContext3D*) override; |
| 212 return object == m_texture; | 164 void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) overrid
e; |
| 213 } | 165 void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) overr
ide; |
| 214 | 166 |
| 215 bool WebGLTextureAttachment::valid() const | 167 RefPtrWillBeMember<WebGLTexture> m_texture; |
| 216 { | 168 GLenum m_target; |
| 217 return m_texture->object(); | 169 GLint m_level; |
| 218 } | 170 }; |
| 219 | 171 |
| 220 void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context) | 172 PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment
::create(WebGLTexture* texture, GLenum target, GLint level) |
| 221 { | 173 { |
| 222 m_texture->onDetached(context); | 174 return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, level)
); |
| 223 } | 175 } |
| 224 | 176 |
| 225 void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum ta
rget, GLenum attachment) | 177 DEFINE_TRACE(WebGLTextureAttachment) |
| 226 { | 178 { |
| 227 Platform3DObject object = objectOrZero(m_texture.get()); | 179 visitor->trace(m_texture); |
| 228 context->framebufferTexture2D(target, attachment, m_target, object, m_le
vel); | 180 WebGLFramebuffer::WebGLAttachment::trace(visitor); |
| 229 } | 181 } |
| 230 | 182 |
| 231 void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum
target, GLenum attachment) | 183 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GLenum tar
get, GLint level) |
| 232 { | 184 : m_texture(texture) |
| 233 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | 185 , m_target(target) |
| 234 context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target,
0, m_level); | 186 , m_level(level) |
| 235 context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_targe
t, 0, m_level); | 187 { |
| 236 } else { | 188 } |
| 237 context->framebufferTexture2D(target, attachment, m_target, 0, m_lev
el); | 189 |
| 238 } | 190 GLsizei WebGLTextureAttachment::width() const |
| 239 } | 191 { |
| 240 | 192 return m_texture->getWidth(m_target, m_level); |
| 241 GLenum WebGLTextureAttachment::type() const | 193 } |
| 242 { | 194 |
| 243 return m_texture->getType(m_target, m_level); | 195 GLsizei WebGLTextureAttachment::height() const |
| 244 } | 196 { |
| 245 | 197 return m_texture->getHeight(m_target, m_level); |
| 246 bool isColorRenderable(GLenum internalformat) | 198 } |
| 247 { | 199 |
| 248 switch (internalformat) { | 200 GLenum WebGLTextureAttachment::format() const |
| 249 case GL_RGB: | 201 { |
| 250 case GL_RGBA: | 202 return m_texture->getInternalFormat(m_target, m_level); |
| 251 case GL_SRGB_ALPHA_EXT: | 203 } |
| 252 case GL_R8: | 204 |
| 253 case GL_R8UI: | 205 WebGLSharedObject* WebGLTextureAttachment::object() const |
| 254 case GL_R8I: | 206 { |
| 255 case GL_R16UI: | 207 return m_texture->object() ? m_texture.get() : 0; |
| 256 case GL_R16I: | 208 } |
| 257 case GL_R32UI: | 209 |
| 258 case GL_R32I: | 210 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const |
| 259 case GL_RG8: | 211 { |
| 260 case GL_RG8UI: | 212 return object == m_texture; |
| 261 case GL_RG8I: | 213 } |
| 262 case GL_RG16UI: | 214 |
| 263 case GL_RG16I: | 215 bool WebGLTextureAttachment::valid() const |
| 264 case GL_RG32UI: | 216 { |
| 265 case GL_RG32I: | 217 return m_texture->object(); |
| 266 case GL_RGB8: | 218 } |
| 267 case GL_RGB565: | 219 |
| 268 case GL_RGBA8: | 220 void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context) |
| 269 case GL_SRGB8_ALPHA8: | 221 { |
| 270 case GL_RGB5_A1: | 222 m_texture->onDetached(context); |
| 271 case GL_RGBA4: | 223 } |
| 272 case GL_RGB10_A2: | 224 |
| 273 case GL_RGBA8UI: | 225 void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum target
, GLenum attachment) |
| 274 case GL_RGBA8I: | 226 { |
| 275 case GL_RGB10_A2UI: | 227 Platform3DObject object = objectOrZero(m_texture.get()); |
| 276 case GL_RGBA16UI: | 228 context->framebufferTexture2D(target, attachment, m_target, object, m_level)
; |
| 277 case GL_RGBA16I: | 229 } |
| 278 case GL_RGBA32UI: | 230 |
| 279 case GL_RGBA32I: | 231 void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum targ
et, GLenum attachment) |
| 280 return true; | 232 { |
| 281 default: | 233 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 282 return false; | 234 context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target, 0,
m_level); |
| 283 } | 235 context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_target, 0
, m_level); |
| 284 } | 236 } else { |
| 285 | 237 context->framebufferTexture2D(target, attachment, m_target, 0, m_level); |
| 286 bool isDepthRenderable(GLenum internalformat, bool includesDepthStencil) | 238 } |
| 287 { | 239 } |
| 288 switch (internalformat) { | 240 |
| 289 case GL_DEPTH_COMPONENT: | 241 GLenum WebGLTextureAttachment::type() const |
| 290 case GL_DEPTH_COMPONENT16: | 242 { |
| 291 case GL_DEPTH_COMPONENT24: | 243 return m_texture->getType(m_target, m_level); |
| 292 case GL_DEPTH_COMPONENT32F: | 244 } |
| 293 return true; | 245 |
| 294 case GL_DEPTH_STENCIL: | 246 bool isColorRenderable(GLenum internalformat) |
| 295 case GL_DEPTH24_STENCIL8: | 247 { |
| 296 case GL_DEPTH32F_STENCIL8: | 248 switch (internalformat) { |
| 297 return includesDepthStencil; | 249 case GL_RGB: |
| 298 default: | 250 case GL_RGBA: |
| 299 return false; | 251 case GL_SRGB_ALPHA_EXT: |
| 300 } | 252 case GL_R8: |
| 301 } | 253 case GL_R8UI: |
| 302 | 254 case GL_R8I: |
| 303 bool isStencilRenderable(GLenum internalformat, bool includesDepthStencil) | 255 case GL_R16UI: |
| 304 { | 256 case GL_R16I: |
| 305 switch (internalformat) { | 257 case GL_R32UI: |
| 306 case GL_STENCIL_INDEX8: | 258 case GL_R32I: |
| 307 return true; | 259 case GL_RG8: |
| 308 case GL_DEPTH_STENCIL: | 260 case GL_RG8UI: |
| 309 case GL_DEPTH24_STENCIL8: | 261 case GL_RG8I: |
| 310 case GL_DEPTH32F_STENCIL8: | 262 case GL_RG16UI: |
| 311 return includesDepthStencil; | 263 case GL_RG16I: |
| 312 default: | 264 case GL_RG32UI: |
| 313 return false; | 265 case GL_RG32I: |
| 314 } | 266 case GL_RGB8: |
| 315 } | 267 case GL_RGB565: |
| 268 case GL_RGBA8: |
| 269 case GL_SRGB8_ALPHA8: |
| 270 case GL_RGB5_A1: |
| 271 case GL_RGBA4: |
| 272 case GL_RGB10_A2: |
| 273 case GL_RGBA8UI: |
| 274 case GL_RGBA8I: |
| 275 case GL_RGB10_A2UI: |
| 276 case GL_RGBA16UI: |
| 277 case GL_RGBA16I: |
| 278 case GL_RGBA32UI: |
| 279 case GL_RGBA32I: |
| 280 return true; |
| 281 default: |
| 282 return false; |
| 283 } |
| 284 } |
| 285 |
| 286 bool isDepthRenderable(GLenum internalformat, bool includesDepthStencil) |
| 287 { |
| 288 switch (internalformat) { |
| 289 case GL_DEPTH_COMPONENT: |
| 290 case GL_DEPTH_COMPONENT16: |
| 291 case GL_DEPTH_COMPONENT24: |
| 292 case GL_DEPTH_COMPONENT32F: |
| 293 return true; |
| 294 case GL_DEPTH_STENCIL: |
| 295 case GL_DEPTH24_STENCIL8: |
| 296 case GL_DEPTH32F_STENCIL8: |
| 297 return includesDepthStencil; |
| 298 default: |
| 299 return false; |
| 300 } |
| 301 } |
| 302 |
| 303 bool isStencilRenderable(GLenum internalformat, bool includesDepthStencil) |
| 304 { |
| 305 switch (internalformat) { |
| 306 case GL_STENCIL_INDEX8: |
| 307 return true; |
| 308 case GL_DEPTH_STENCIL: |
| 309 case GL_DEPTH24_STENCIL8: |
| 310 case GL_DEPTH32F_STENCIL8: |
| 311 return includesDepthStencil; |
| 312 default: |
| 313 return false; |
| 314 } |
| 315 } |
| 316 | 316 |
| 317 } // anonymous namespace | 317 } // anonymous namespace |
| 318 | 318 |
| 319 WebGLFramebuffer::WebGLAttachment::WebGLAttachment() | 319 WebGLFramebuffer::WebGLAttachment::WebGLAttachment() |
| 320 { | 320 { |
| 321 } | 321 } |
| 322 | 322 |
| 323 WebGLFramebuffer::WebGLAttachment::~WebGLAttachment() | 323 WebGLFramebuffer::WebGLAttachment::~WebGLAttachment() |
| 324 { | 324 { |
| 325 } | 325 } |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 663 |
| 664 DEFINE_TRACE(WebGLFramebuffer) | 664 DEFINE_TRACE(WebGLFramebuffer) |
| 665 { | 665 { |
| 666 #if ENABLE(OILPAN) | 666 #if ENABLE(OILPAN) |
| 667 visitor->trace(m_attachments); | 667 visitor->trace(m_attachments); |
| 668 #endif | 668 #endif |
| 669 WebGLContextObject::trace(visitor); | 669 WebGLContextObject::trace(visitor); |
| 670 } | 670 } |
| 671 | 671 |
| 672 } | 672 } |
| OLD | NEW |