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 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 if (!framebufferBinding || !framebufferBinding->object()) { | 2430 if (!framebufferBinding || !framebufferBinding->object()) { |
2431 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTexture2D", "no fram
ebuffer bound"); | 2431 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTexture2D", "no fram
ebuffer bound"); |
2432 return; | 2432 return; |
2433 } | 2433 } |
2434 Platform3DObject textureObject = objectOrZero(texture); | 2434 Platform3DObject textureObject = objectOrZero(texture); |
2435 switch (attachment) { | 2435 switch (attachment) { |
2436 case GL_DEPTH_STENCIL_ATTACHMENT: | 2436 case GL_DEPTH_STENCIL_ATTACHMENT: |
2437 webContext()->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarge
t, textureObject, level); | 2437 webContext()->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarge
t, textureObject, level); |
2438 webContext()->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textar
get, textureObject, level); | 2438 webContext()->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textar
get, textureObject, level); |
2439 break; | 2439 break; |
2440 case GL_DEPTH_ATTACHMENT: | |
2441 webContext()->framebufferTexture2D(target, attachment, textarget, textur
eObject, level); | |
2442 break; | |
2443 case GL_STENCIL_ATTACHMENT: | |
2444 webContext()->framebufferTexture2D(target, attachment, textarget, textur
eObject, level); | |
2445 break; | |
2446 default: | 2440 default: |
2447 webContext()->framebufferTexture2D(target, attachment, textarget, textur
eObject, level); | 2441 webContext()->framebufferTexture2D(target, attachment, textarget, textur
eObject, level); |
2448 } | 2442 } |
2449 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, tex
target, texture, level, 0); | 2443 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 2444 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN
T + STENCIL_ATTACHMENT. |
| 2445 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP
TH_STENCIL_ATTACHMENT in WebGL 2. |
| 2446 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT
TACHMENT, textarget, texture, level, 0); |
| 2447 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_
ATTACHMENT, textarget, texture, level, 0); |
| 2448 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_
DEPTH_ATTACHMENT, texture); |
| 2449 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_
STENCIL_ATTACHMENT, texture); |
| 2450 } else { |
| 2451 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment,
textarget, texture, level, 0); |
| 2452 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", att
achment, texture); |
| 2453 } |
2450 applyStencilTest(); | 2454 applyStencilTest(); |
2451 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", attachm
ent, texture); | |
2452 } | 2455 } |
2453 | 2456 |
2454 void WebGLRenderingContextBase::frontFace(GLenum mode) | 2457 void WebGLRenderingContextBase::frontFace(GLenum mode) |
2455 { | 2458 { |
2456 if (isContextLost()) | 2459 if (isContextLost()) |
2457 return; | 2460 return; |
2458 webContext()->frontFace(mode); | 2461 webContext()->frontFace(mode); |
2459 } | 2462 } |
2460 | 2463 |
2461 void WebGLRenderingContextBase::generateMipmap(GLenum target) | 2464 void WebGLRenderingContextBase::generateMipmap(GLenum target) |
(...skipping 4475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6937 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6940 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
6938 } | 6941 } |
6939 | 6942 |
6940 void WebGLRenderingContextBase::restoreUnpackParameters() | 6943 void WebGLRenderingContextBase::restoreUnpackParameters() |
6941 { | 6944 { |
6942 if (m_unpackAlignment != 1) | 6945 if (m_unpackAlignment != 1) |
6943 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6946 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
6944 } | 6947 } |
6945 | 6948 |
6946 } // namespace blink | 6949 } // namespace blink |
OLD | NEW |