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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2040773002: Upload textures through GPU path to non-8-bit color formats won't work in WebGL2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4138 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. 4138 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented.
4139 type = GL_FLOAT; 4139 type = GL_FLOAT;
4140 } 4140 }
4141 texImage2DImpl(target, level, internalformat, format, type, imageForRender.g et(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlph a); 4141 texImage2DImpl(target, level, internalformat, format, type, imageForRender.g et(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlph a);
4142 } 4142 }
4143 4143
4144 bool WebGLRenderingContextBase::canUseTexImageCanvasByGPU(GLint internalformat, GLenum type) 4144 bool WebGLRenderingContextBase::canUseTexImageCanvasByGPU(GLint internalformat, GLenum type)
4145 { 4145 {
4146 if (isFloatType(type) || isIntegerFormat(internalformat) || isSRGBFormat(int ernalformat)) 4146 if (isFloatType(type) || isIntegerFormat(internalformat) || isSRGBFormat(int ernalformat))
4147 return false; 4147 return false;
4148 switch (internalformat) {
4149 case GL_RGB565:
4150 case GL_RGBA4:
4151 case GL_RGB5_A1:
Zhenyao Mo 2016/06/06 12:47:47 I think these are the only packed formats that goe
Corentin Wallez 2016/06/06 15:25:46 What is the alternative path?
Zhenyao Mo 2016/06/06 16:09:20 We pack them into target format in software and th
4152 // FIXME: ES3 limitation that CopyTexImage with sized internalformat,
4153 // component sizes have to match the source color format.
Ken Russell (switch to Gerrit) 2016/06/06 23:23:48 Do you think it would be worth making canUseTexIma
Zhenyao Mo 2016/06/07 00:36:50 Done. RGB565 is only not renderable on Mac NVidia
4154 return false;
4155 default:
4156 break;
4157 }
4148 return true; 4158 return true;
4149 } 4159 }
4150 4160
4151 void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy pe, WebGLTexture* texture, GLenum target, 4161 void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy pe, WebGLTexture* texture, GLenum target,
4152 GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint yoffset , GLint zoffset, HTMLCanvasElement* canvas) 4162 GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint yoffset , GLint zoffset, HTMLCanvasElement* canvas)
4153 { 4163 {
4154 ScopedTexture2DRestorer restorer(this); 4164 ScopedTexture2DRestorer restorer(this);
4155 4165
4156 GLuint targetTexture = texture->object(); 4166 GLuint targetTexture = texture->object();
4157 GLenum targetType = type; 4167 GLenum targetType = type;
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
6424 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6434 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6425 } 6435 }
6426 6436
6427 void WebGLRenderingContextBase::restoreUnpackParameters() 6437 void WebGLRenderingContextBase::restoreUnpackParameters()
6428 { 6438 {
6429 if (m_unpackAlignment != 1) 6439 if (m_unpackAlignment != 1)
6430 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6440 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6431 } 6441 }
6432 6442
6433 } // namespace blink 6443 } // namespace blink
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698