Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 1684973002: Remove blink side texture status caching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index 317bc5951335980ac2a7f64c57327ec438c77f87..1c7f34570322ee4737cf3f6f674b437f6157b753 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -805,10 +805,6 @@ bool WebGL2RenderingContextBase::validateTexStorage(const char* functionName, GL
}
}
- WebGLTexture* tex = validateTextureBinding(functionName, target, false);
- if (!tex)
- return false;
-
if (functionType == TexStorageType3D && target != GL_TEXTURE_2D_ARRAY && m_compressedTextureFormatsETC2EAC.find(internalformat) != m_compressedTextureFormatsETC2EAC.end()) {
synthesizeGLError(GL_INVALID_OPERATION, functionName, "target for ETC2/EAC internal formats must be TEXTURE_2D_ARRAY");
return false;
@@ -819,11 +815,6 @@ bool WebGL2RenderingContextBase::validateTexStorage(const char* functionName, GL
return false;
}
- if (tex->isImmutable()) {
- synthesizeGLError(GL_INVALID_OPERATION, functionName, "attempted to modify immutable texture");
- return false;
- }
-
if (width <= 0 || height <= 0 || depth <= 0) {
synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid dimensions");
return false;
@@ -854,9 +845,7 @@ void WebGL2RenderingContextBase::texStorage2D(GLenum target, GLsizei levels, GLe
if (isContextLost() || !validateTexStorage("texStorage2D", target, levels, internalformat, width, height, 1, TexStorageType2D))
return;
- WebGLTexture* tex = validateTextureBinding("texStorage2D", target, false);
webContext()->texStorage2DEXT(target, levels, internalformat, width, height);
- tex->setTexStorageInfo(target, levels, internalformat, width, height, 1);
}
void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
@@ -864,9 +853,7 @@ void WebGL2RenderingContextBase::texStorage3D(GLenum target, GLsizei levels, GLe
if (isContextLost() || !validateTexStorage("texStorage3D", target, levels, internalformat, width, height, depth, TexStorageType3D))
return;
- WebGLTexture* tex = validateTextureBinding("texStorage3D", target, false);
webContext()->texStorage3D(target, levels, internalformat, width, height, depth);
- tex->setTexStorageInfo(target, levels, internalformat, width, height, depth);
}
void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, DOMArrayBufferView* pixels)
@@ -884,10 +871,7 @@ void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in
return;
}
- WebGLTexture* tex = validateTextureBinding("texImage3D", target, true);
- ASSERT(tex);
webContext()->texImage3D(target, level, convertTexInternalFormat(internalformat, type), width, height, depth, border, format, type, data);
- tex->setLevelInfo(target, level, internalformat, width, height, depth, type);
}
void WebGL2RenderingContextBase::texSubImage3DImpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha)
@@ -1002,18 +986,9 @@ void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
|| !validateTexFunc("texSubImage3D", TexSubImage, SourceHTMLCanvasElement, target, level, 0, canvas->width(), canvas->height(), 1, 0, format, type, xoffset, yoffset, zoffset))
return;
- WebGLTexture* texture = validateTextureBinding("texSubImage3D", target, false);
- ASSERT(texture);
- GLenum internalformat = texture->getInternalFormat(target, level);
-
- if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerated() || !canUseTexImageCanvasByGPU(internalformat, type)) {
- // 2D canvas has only FrontBuffer.
- texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration).get(),
- WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha);
- return;
- }
-
- texImageCanvasByGPU(TexSubImage3DByGPU, texture, target, level, GL_RGBA, type, xoffset, yoffset, zoffset, canvas);
+ // FIXME: Implement GPU-to-GPU copy path.
Ken Russell (switch to Gerrit) 2016/02/11 01:25:01 Could you provide more details about exactly what'
Zhenyao Mo 2016/02/11 02:16:46 Sure, I'll create a bug with more details. But le
+ texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration).get(),
+ WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha);
}
void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exceptionState)
@@ -1050,12 +1025,6 @@ void WebGL2RenderingContextBase::copyTexSubImage3D(GLenum target, GLint level, G
return;
if (!validateReadBufferAndGetInfo("copyTexSubImage3D", readFramebufferBinding))
return;
- WebGLTexture* tex = validateTextureBinding("copyTexSubImage3D", target, true);
- ASSERT(tex);
- if (!isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(target, level), boundFramebufferColorFormat())) {
- synthesizeGLError(GL_INVALID_OPERATION, "copyTexSubImage3D", "framebuffer is incompatible format");
- return;
- }
clearIfComposited();
ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding);
webContext()->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
@@ -1080,16 +1049,7 @@ void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level
if (!validateCompressedTexFuncData("compressedTexImage3D", width, height, depth, internalformat, data))
return;
- WebGLTexture* tex = validateTextureBinding("compressedTexImage3D", target, true);
- if (!tex)
- return;
- if (tex->isImmutable()) {
- synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempted to modify immutable texture");
- return;
- }
-
webContext()->compressedTexImage3D(target, level, internalformat, width, height, depth, border, data->byteLength(), data->baseAddress());
- tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UNSIGNED_BYTE);
}
void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data)
@@ -1105,10 +1065,6 @@ void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le
return;
if (!validateCompressedTexFormat("compressedTexSubImage3D", format))
return;
- if (format != tex->getInternalFormat(target, level)) {
- synthesizeGLError(GL_INVALID_OPERATION, "compressedTexSubImage3D", "format does not match texture format");
- return;
- }
if (!validateCompressedTexSubDimensions("compressedTexSubImage3D", target, level, xoffset, yoffset, zoffset, width, height, depth, format, tex))
return;
if (!validateCompressedTexFuncData("compressedTexSubImage3D", width, height, depth, format, data))
@@ -3465,15 +3421,6 @@ void WebGL2RenderingContextBase::restoreCurrentFramebuffer()
bindFramebuffer(nullptr, GL_READ_FRAMEBUFFER, m_readFramebufferBinding.get());
}
-GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
-{
- if (m_readFramebufferBinding && m_readFramebufferBinding->object())
- return m_readFramebufferBinding->colorBufferFormat();
- if (m_requestedAttributes.alpha())
- return GL_RGBA;
- return GL_RGB;
-}
-
const WebGLSamplerState* WebGL2RenderingContextBase::getTextureUnitSamplerState(GLenum target, GLuint unit) const
{
ASSERT(unit < m_samplerUnits.size());

Powered by Google App Engine
This is Rietveld 408576698