| 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 4398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4409 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) | 4409 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) |
| 4410 { | 4410 { |
| 4411 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | 4411 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. |
| 4412 bool resetActiveUnit = false; | 4412 bool resetActiveUnit = false; |
| 4413 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) | 4413 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) |
| 4414 | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::Textu
reHalfFloatLinearExtensionEnabled : 0)); | 4414 | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::Textu
reHalfFloatLinearExtensionEnabled : 0)); |
| 4415 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { | 4415 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { |
| 4416 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) | 4416 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) |
| 4417 || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUni
ts[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) { | 4417 || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUni
ts[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) { |
| 4418 if (ii != m_activeTextureUnit) { | 4418 if (ii != m_activeTextureUnit) { |
| 4419 webContext()->activeTexture(ii); | 4419 webContext()->activeTexture(GL_TEXTURE0 + ii); |
| 4420 resetActiveUnit = true; | 4420 resetActiveUnit = true; |
| 4421 } else if (resetActiveUnit) { | 4421 } else if (resetActiveUnit) { |
| 4422 webContext()->activeTexture(ii); | 4422 webContext()->activeTexture(GL_TEXTURE0 + ii); |
| 4423 resetActiveUnit = false; | 4423 resetActiveUnit = false; |
| 4424 } | 4424 } |
| 4425 WebGLTexture* tex2D; | 4425 WebGLTexture* tex2D; |
| 4426 WebGLTexture* texCubeMap; | 4426 WebGLTexture* texCubeMap; |
| 4427 if (prepareToDraw) { | 4427 if (prepareToDraw) { |
| 4428 String msg(String("texture bound to texture unit ") + String::nu
mber(ii) | 4428 String msg(String("texture bound to texture unit ") + String::nu
mber(ii) |
| 4429 + " is not renderable. It maybe non-power-of-2 and have inco
mpatible texture filtering or is not 'texture complete'." | 4429 + " is not renderable. It maybe non-power-of-2 and have inco
mpatible texture filtering or is not 'texture complete'." |
| 4430 + " Or the texture is Float or Half Float type with linear f
iltering while OES_float_linear or OES_half_float_linear extension is not enable
d."); | 4430 + " Or the texture is Float or Half Float type with linear f
iltering while OES_float_linear or OES_half_float_linear extension is not enable
d."); |
| 4431 emitGLWarning(functionName, msg.utf8().data()); | 4431 emitGLWarning(functionName, msg.utf8().data()); |
| 4432 tex2D = m_blackTexture2D.get(); | 4432 tex2D = m_blackTexture2D.get(); |
| 4433 texCubeMap = m_blackTextureCubeMap.get(); | 4433 texCubeMap = m_blackTextureCubeMap.get(); |
| 4434 } else { | 4434 } else { |
| 4435 tex2D = m_textureUnits[ii].m_texture2DBinding.get(); | 4435 tex2D = m_textureUnits[ii].m_texture2DBinding.get(); |
| 4436 texCubeMap = m_textureUnits[ii].m_textureCubeMapBinding.get(); | 4436 texCubeMap = m_textureUnits[ii].m_textureCubeMapBinding.get(); |
| 4437 } | 4437 } |
| 4438 if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_te
xture2DBinding->needToUseBlackTexture(flag)) | 4438 if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_te
xture2DBinding->needToUseBlackTexture(flag)) |
| 4439 webContext()->bindTexture(GL_TEXTURE_2D, objectOrZero(tex2D)); | 4439 webContext()->bindTexture(GL_TEXTURE_2D, objectOrZero(tex2D)); |
| 4440 if (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii]
.m_textureCubeMapBinding->needToUseBlackTexture(flag)) | 4440 if (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii]
.m_textureCubeMapBinding->needToUseBlackTexture(flag)) |
| 4441 webContext()->bindTexture(GL_TEXTURE_CUBE_MAP, objectOrZero(texC
ubeMap)); | 4441 webContext()->bindTexture(GL_TEXTURE_CUBE_MAP, objectOrZero(texC
ubeMap)); |
| 4442 } | 4442 } |
| 4443 } | 4443 } |
| 4444 if (resetActiveUnit) | 4444 if (resetActiveUnit) |
| 4445 webContext()->activeTexture(m_activeTextureUnit); | 4445 webContext()->activeTexture(GL_TEXTURE0 + m_activeTextureUnit); |
| 4446 } | 4446 } |
| 4447 | 4447 |
| 4448 void WebGLRenderingContextBase::createFallbackBlackTextures1x1() | 4448 void WebGLRenderingContextBase::createFallbackBlackTextures1x1() |
| 4449 { | 4449 { |
| 4450 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | 4450 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. |
| 4451 unsigned char black[] = {0, 0, 0, 255}; | 4451 unsigned char black[] = {0, 0, 0, 255}; |
| 4452 m_blackTexture2D = createTexture(); | 4452 m_blackTexture2D = createTexture(); |
| 4453 webContext()->bindTexture(GL_TEXTURE_2D, m_blackTexture2D->object()); | 4453 webContext()->bindTexture(GL_TEXTURE_2D, m_blackTexture2D->object()); |
| 4454 webContext()->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, | 4454 webContext()->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, |
| 4455 0, GL_RGBA, GL_UNSIGNED_BYTE, black); | 4455 0, GL_RGBA, GL_UNSIGNED_BYTE, black); |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5719 if (m_textureUnits[i].m_texture2DBinding | 5719 if (m_textureUnits[i].m_texture2DBinding |
| 5720 || m_textureUnits[i].m_textureCubeMapBinding) { | 5720 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5721 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5721 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5722 return; | 5722 return; |
| 5723 } | 5723 } |
| 5724 } | 5724 } |
| 5725 m_onePlusMaxNonDefaultTextureUnit = 0; | 5725 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5726 } | 5726 } |
| 5727 | 5727 |
| 5728 } // namespace WebCore | 5728 } // namespace WebCore |
| OLD | NEW |