| Index: Source/core/html/canvas/WebGLRenderingContext.cpp
|
| diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
|
| index 37deadcb6b5c80d9d0c597d1202f0315925941b4..ec566ddc45f7fe198de8aceec12f0c20d36f5c6d 100644
|
| --- a/Source/core/html/canvas/WebGLRenderingContext.cpp
|
| +++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
|
| @@ -38,7 +38,9 @@
|
| #include "core/html/canvas/OESElementIndexUint.h"
|
| #include "core/html/canvas/OESStandardDerivatives.h"
|
| #include "core/html/canvas/OESTextureFloat.h"
|
| +#include "core/html/canvas/OESTextureFloatLinear.h"
|
| #include "core/html/canvas/OESTextureHalfFloat.h"
|
| +#include "core/html/canvas/OESTextureHalfFloatLinear.h"
|
| #include "core/html/canvas/OESVertexArrayObject.h"
|
| #include "core/html/canvas/WebGLActiveInfo.h"
|
| #include "core/html/canvas/WebGLBuffer.h"
|
| @@ -634,8 +636,7 @@ void WebGLRenderingContext::initializeNewContext()
|
|
|
| m_vertexAttribValue.resize(m_maxVertexAttribs);
|
|
|
| - if (!isGLES2NPOTStrict())
|
| - createFallbackBlackTextures1x1();
|
| + createFallbackBlackTextures1x1();
|
|
|
| IntSize canvasSize = clampedCanvasSize();
|
| m_drawingBuffer->reset(canvasSize);
|
| @@ -1750,12 +1751,9 @@ void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei c
|
|
|
| clearIfComposited();
|
|
|
| - bool vertexAttrib0Simulated = false;
|
| - if (!isGLES2NPOTStrict())
|
| - handleNPOTTextures("drawArrays", true);
|
| + handleTextureCompleteness("drawArrays", true);
|
| m_context->drawArrays(mode, first, count);
|
| - if (!isGLES2NPOTStrict())
|
| - handleNPOTTextures("drawArrays", false);
|
| + handleTextureCompleteness("drawArrays", false);
|
| markContextChanged();
|
| }
|
|
|
| @@ -1811,11 +1809,9 @@ void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denu
|
| }
|
| clearIfComposited();
|
|
|
| - if (!isGLES2NPOTStrict())
|
| - handleNPOTTextures("drawElements", true);
|
| + handleTextureCompleteness("drawElements", true);
|
| m_context->drawElements(mode, count, type, static_cast<GC3Dintptr>(offset));
|
| - if (!isGLES2NPOTStrict())
|
| - handleNPOTTextures("drawElements", false);
|
| + handleTextureCompleteness("drawElements", false);
|
| markContextChanged();
|
| }
|
|
|
| @@ -2135,6 +2131,10 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
|
| return extension;
|
| if (getExtensionIfMatch<EXTDrawBuffers>(name, m_extDrawBuffers, unprefixed, extension))
|
| return extension;
|
| + if (getExtensionIfMatch<OESTextureFloatLinear>(name, m_oesTextureFloatLinear, unprefixed, extension))
|
| + return extension;
|
| + if (getExtensionIfMatch<OESTextureHalfFloatLinear>(name, m_oesTextureHalfFloatLinear, unprefixed, extension))
|
| + return extension;
|
| if (allowPrivilegedExtensions()) {
|
| if (getExtensionIfMatch<WebGLDebugRendererInfo>(name, m_webglDebugRendererInfo, unprefixed, extension))
|
| return extension;
|
| @@ -2621,6 +2621,9 @@ Vector<String> WebGLRenderingContext::getSupportedExtensions()
|
| appendIfSupported<OESElementIndexUint>(result, false);
|
| appendIfSupported<OESStandardDerivatives>(result, false);
|
| appendIfSupported<OESTextureFloat>(result, false);
|
| + appendIfSupported<OESTextureFloatLinear>(result, false);
|
| + appendIfSupported<OESTextureHalfFloat>(result, false);
|
| + appendIfSupported<OESTextureHalfFloatLinear>(result, false);
|
| appendIfSupported<OESVertexArrayObject>(result, false);
|
| appendIfSupported<WebGLCompressedTextureATC>(result, true);
|
| appendIfSupported<WebGLCompressedTexturePVRTC>(result, true);
|
| @@ -4349,13 +4352,15 @@ WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(GC3Denum pname)
|
| return WebGLGetInfo(Int32Array::create(value, length));
|
| }
|
|
|
| -void WebGLRenderingContext::handleNPOTTextures(const char* functionName, bool prepareToDraw)
|
| +void WebGLRenderingContext::handleTextureCompleteness(const char* functionName, bool prepareToDraw)
|
| {
|
| // All calling functions check isContextLost, so a duplicate check is not needed here.
|
| bool resetActiveUnit = false;
|
| + WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureExtensionFlag>((m_oesTextureFloatLinear ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0)
|
| + | (m_oesTextureHalfFloatLinear ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0));
|
| for (unsigned ii = 0; ii < m_textureUnits.size(); ++ii) {
|
| - if ((m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture())
|
| - || (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture())) {
|
| + if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture(flag))
|
| + || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) {
|
| if (ii != m_activeTextureUnit) {
|
| m_context->activeTexture(ii);
|
| resetActiveUnit = true;
|
| @@ -4367,7 +4372,8 @@ void WebGLRenderingContext::handleNPOTTextures(const char* functionName, bool pr
|
| WebGLTexture* texCubeMap;
|
| if (prepareToDraw) {
|
| String msg(String("texture bound to texture unit ") + String::number(ii)
|
| - + " is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'");
|
| + + " is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'."
|
| + + " Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled.");
|
| printGLWarningToConsole(functionName, msg.utf8().data());
|
| tex2D = m_blackTexture2D.get();
|
| texCubeMap = m_blackTextureCubeMap.get();
|
| @@ -4375,9 +4381,9 @@ void WebGLRenderingContext::handleNPOTTextures(const char* functionName, bool pr
|
| tex2D = m_textureUnits[ii].m_texture2DBinding.get();
|
| texCubeMap = m_textureUnits[ii].m_textureCubeMapBinding.get();
|
| }
|
| - if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture())
|
| + if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture(flag))
|
| m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(tex2D));
|
| - if (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture())
|
| + if (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))
|
| m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, objectOrZero(texCubeMap));
|
| }
|
| }
|
|
|