Commit fbae9a94 authored by zmo's avatar zmo Committed by Commit bot

Upload textures through GPU path to non-8-bit color formats won't work in WebGL2

This is because we use copyTexImage to do the GPU to GPU copying, but in ES3
it is limited that source/destination color format component sizes have to match.

We can lift this limitation once we implement a different path where shaders are
used to do the copying instead of copyTexImage.

BUG=429053
TEST=gpu_bots
R=kbr@chromium.org,cwallez@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel;tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2040773002
Cr-Commit-Position: refs/heads/master@{#398230}
parent 59a2e54e
...@@ -78,45 +78,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations): ...@@ -78,45 +78,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
self.Fail('deqp/functional/gles3/multisample.html', self.Fail('deqp/functional/gles3/multisample.html',
['amd'], bug=617290) ['amd'], bug=617290)
# Failing because the tests are using invalid combinations of source and
# destination formats, see https://github.com/KhronosGroup/WebGL/issues/1628
self.Fail('conformance2/textures/webgl_canvas/' +
'tex-2d-rgb565-rgb-unsigned_byte.html',
bug=483282)
self.Fail('conformance2/textures/webgl_canvas/' +
'tex-2d-rgb565-rgb-unsigned_short_5_6_5.html',
bug=483282)
self.Fail('conformance2/textures/webgl_canvas/' +
'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
bug=483282)
self.Fail('conformance2/textures/webgl_canvas/' +
'tex-2d-rgb5_a1-rgba-unsigned_short_5_5_5_1.html',
bug=483282)
self.Fail('conformance2/textures/webgl_canvas/' +
'tex-2d-rgba4-rgba-unsigned_byte.html',
bug=483282)
self.Fail('conformance2/textures/webgl_canvas/' +
'tex-2d-rgba4-rgba-unsigned_short_4_4_4_4.html',
bug=483282)
self.Fail('conformance2/textures/canvas/' +
'tex-2d-rgb565-rgb-unsigned_byte.html',
bug=483282)
self.Fail('conformance2/textures/canvas/' +
'tex-2d-rgb565-rgb-unsigned_short_5_6_5.html',
bug=483282)
self.Fail('conformance2/textures/canvas/' +
'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
bug=483282)
self.Fail('conformance2/textures/canvas/' +
'tex-2d-rgb5_a1-rgba-unsigned_short_5_5_5_1.html',
bug=483282)
self.Fail('conformance2/textures/canvas/' +
'tex-2d-rgba4-rgba-unsigned_byte.html',
bug=483282)
self.Fail('conformance2/textures/canvas/' +
'tex-2d-rgba4-rgba-unsigned_short_4_4_4_4.html',
bug=483282)
# Windows only. # Windows only.
self.Fail('deqp/functional/gles3/vertexarrays.html', self.Fail('deqp/functional/gles3/vertexarrays.html',
......
...@@ -461,6 +461,21 @@ bool WebGL2RenderingContextBase::checkAndTranslateAttachments(const char* functi ...@@ -461,6 +461,21 @@ bool WebGL2RenderingContextBase::checkAndTranslateAttachments(const char* functi
return true; return true;
} }
bool WebGL2RenderingContextBase::canUseTexImageCanvasByGPU(GLint internalformat, GLenum type)
{
switch (internalformat) {
case GL_RGB565:
case GL_RGBA4:
case GL_RGB5_A1:
// FIXME: ES3 limitation that CopyTexImage with sized internalformat,
// component sizes have to match the source color format.
return false;
default:
break;
}
return WebGLRenderingContextBase::canUseTexImageCanvasByGPU(internalformat, type);
}
void WebGL2RenderingContextBase::invalidateFramebuffer(GLenum target, const Vector<GLenum>& attachments) void WebGL2RenderingContextBase::invalidateFramebuffer(GLenum target, const Vector<GLenum>& attachments)
{ {
if (isContextLost()) if (isContextLost())
......
...@@ -271,6 +271,8 @@ protected: ...@@ -271,6 +271,8 @@ protected:
WebGLBuffer* validateBufferDataTarget(const char* functionName, GLenum target) override; WebGLBuffer* validateBufferDataTarget(const char* functionName, GLenum target) override;
bool validateBufferDataUsage(const char* functionName, GLenum usage) override; bool validateBufferDataUsage(const char* functionName, GLenum usage) override;
bool canUseTexImageCanvasByGPU(GLint internalformat, GLenum type) override;
void removeBoundBuffer(WebGLBuffer*) override; void removeBoundBuffer(WebGLBuffer*) override;
void resetUnpackParameters() override; void resetUnpackParameters() override;
......
...@@ -792,7 +792,7 @@ protected: ...@@ -792,7 +792,7 @@ protected:
// Copy from the canvas element directly to the texture via the GPU, without a read-back to system memory. // Copy from the canvas element directly to the texture via the GPU, without a read-back to system memory.
void texImageCanvasByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GLint level, void texImageCanvasByGPU(TexImageByGPUType, WebGLTexture*, GLenum target, GLint level,
GLint internalformat, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLCanvasElement*); GLint internalformat, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLCanvasElement*);
bool canUseTexImageCanvasByGPU(GLint internalformat, GLenum type); virtual bool canUseTexImageCanvasByGPU(GLint internalformat, GLenum type);
virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams(); virtual WebGLImageConversion::PixelStoreParams getPackPixelStoreParams();
virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(TexImageDimension); virtual WebGLImageConversion::PixelStoreParams getUnpackPixelStoreParams(TexImageDimension);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment