New issue
Advanced search Search tips

Issue 716018 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 2
Type: Bug



Sign in to add a comment

Uniform Block Indexes Invalid if getShaderParameter not called.

Reported by tshe...@gmail.com, Apr 27 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36

Steps to reproduce the problem:
Open the attached test case

What is the expected behavior?
Draws a red triangle, no console errors

What went wrong?
Draws a white triangle because the indices returned by gl.getUniformBlockIndex are invalid. Error reported to console: WebGL: INVALID_VALUE: uniformBlockBinding: invalid uniform block index

Did this work before? Yes 57 on WIndows, Not sure on Linux.

Does this work in other browsers? Yes

Chrome version: 58.0.3029.81  Channel: stable
OS Version: Ubuntu 16.04
Flash Version: 

Oddly, uncommenting the calls to getShaderParameter on lines 74-75 get this working. 

This appears to be a regression in Chrome 58. Tested on my Windows machine in Chrome 57, it worked, then updated to Chrome 58 and saw the same error.

Works in Firefox on both machines.

chrome://gpu info is attached.
 
ubo-getshaderparameter.html
3.8 KB View Download
gpu.html
59.6 KB View Download
Labels: OS-Windows
Status: Available (was: Unconfirmed)
Reproduces on my Linux/NVIDIA. Actually, it's a bit weird. It rendered red the first time, and white when I closed it and opened it again. Didn't check the console the first time. Doesn't repro on my Mac/Intel.

+OS-Windows
Tried restarting the browser and it's still white. I suspect something is going on with the shader cache?

Comment 3 by tshe...@gmail.com, Apr 28 2017

Some interesting additional info that might help track this down:
If I call gl.getActiveUniformBlockName in the version that doesn't work, it returns what looks to be some kind of hash, like "webgl_7cc7290f50372ae2", for both uniform blocks.

If the calls to gl.getShaderParameter are included, it correctly returns "Uniforms1" and "Uniforms2".

Comment 4 by tshe...@gmail.com, Apr 28 2017

Additionally, those hashes work fine if you use them as the uniform block names for getUniformBlockIndex. So the core issue seems to just be that the internal names for the uniform blocks don't match what was written the GLSL. 
Owner: kainino@chromium.org
Status: Assigned (was: Available)
Status: Started (was: Assigned)
Thanks, that's some very useful info. I'm looking into this.

FYI, webgl_7cc7290f50372ae2 is an identifier generated by the ANGLE shader translator. It's visible via WEBGL_debug_shaders.
Status update: some shader metadata is not correctly loaded from the shader cache. Specifically Shader::name_map_ is not loaded. This affects uniform blocks and possibly transform feedback varyings.

A conformance test should be possible by creating two programs from the same shader sources, then verifying getShaderParameter and getActiveUniformBlockName
> Tried restarting the browser and it's still white. I suspect something is going on with the shader cache?

No longer seems to persist across browser reboots. I guess I didn't fully reboot the browser.
Labels: -Type-Bug-Regression Type-Bug
Tried a bisect, and as suspected this doesn't seem to be a regression - unmarking as such. Probably looked like a regression due to some caching behavior.
I experimented with transform feedback varyings and wasn't able to reveal a bug there. However, that code still uses name_map which seems fragile.

Test: https://github.com/KhronosGroup/WebGL/pull/2388
Fix: https://codereview.chromium.org/2852923004

Comment 11 by kbr@chromium.org, May 1 2017

Thanks for looking into the transform feedback varyings issue Kai.

It would still be worth getting rid of its use of the name_map, I think, since it's known that the name_map isn't reconstructed when loading program binaries from the cache.


I was able to uncover the error in transform feedback varying queries and the test for that is here:
https://github.com/KhronosGroup/WebGL/pull/2389

A minimal fix is now here:
https://codereview.chromium.org/2857083002/
while the original patch has turned into more of a refactoring:
https://codereview.chromium.org/2852923004/
Project Member

Comment 13 by bugdroid1@chromium.org, May 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/830b099d96036c04006e844f36803bf6fc23443a

commit 830b099d96036c04006e844f36803bf6fc23443a
Author: kainino <kainino@chromium.org>
Date: Thu May 04 00:13:51 2017

Fix behavior of GetOriginalNameFromHashedName

This is a minimal fix for issues with getUniformBlockIndex and
getTransformFeedbackVarying. Also removes unused Shader::GetMappedName.

This corrects the behavior of GetOriginalNameFromHashedName.
Previously, uniform block names were unmapped using "name_map", but
name_map was not restored upon load. Now, instead of name_map, the five
info maps (attrib, uniform, varying, interface block, output variable)
are queried serially in GetOriginalNameFromHashedName.

Unused code around name_map will be removed in a subsequent CL.

BUG= 716018 
TEST=https://github.com/KhronosGroup/WebGL/pull/2388
TEST=https://github.com/KhronosGroup/WebGL/pull/2389
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2857083002
Cr-Commit-Position: refs/heads/master@{#469209}

[modify] https://crrev.com/830b099d96036c04006e844f36803bf6fc23443a/gpu/command_buffer/service/shader_manager.cc
[modify] https://crrev.com/830b099d96036c04006e844f36803bf6fc23443a/gpu/command_buffer/service/shader_manager.h

Status: Fixed (was: Started)
Project Member

Comment 15 by bugdroid1@chromium.org, May 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/78c79d2aff281ddebbe220a1f41214d3c071f16b

commit 78c79d2aff281ddebbe220a1f41214d3c071f16b
Author: kainino <kainino@chromium.org>
Date: Thu May 04 18:45:30 2017

Remove NameMap from shader translator and shader/program managers

NameMap, which after the previous patch is no longer used by the shader/program managers, is removed, and the tests updated.

Tests are also added for GetOriginalNameFromHashedName, though these don't actually hit the original error case in the bug report. That's a difficult integration issue and is tested instead by the WebGL conformance tests.

Usages of GetOriginalNameFromHashedName are replaced with more specific methods calls in Program::{GetTransformFeedbackVaryings,GetUniformBlocks}. This avoids querying the unnecessary extra four info maps.

BUG= 716018 
TEST=https://github.com/KhronosGroup/WebGL/pull/2388
TEST=https://github.com/KhronosGroup/WebGL/pull/2389
TEST=ShaderManagerTest.DoCompile
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2852923004
Cr-Commit-Position: refs/heads/master@{#469398}

[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/memory_program_cache_unittest.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/program_manager.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/program_manager.h
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/program_manager_unittest.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/shader_manager.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/shader_manager.h
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/shader_manager_unittest.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/shader_translator.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/shader_translator.h
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/shader_translator_unittest.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/test_helper.cc
[modify] https://crrev.com/78c79d2aff281ddebbe220a1f41214d3c071f16b/gpu/command_buffer/service/test_helper.h

Project Member

Comment 16 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e9cc6305714c1a585bc5cf51d289fdf000070ea0

commit e9cc6305714c1a585bc5cf51d289fdf000070ea0
Author: Kai Ninomiya <kainino@chromium.org>
Date: Fri May 19 22:31:11 2017

ShaderManagerTest.DoCompile: test interface blocks

Follow-up to https://codereview.chromium.org/2852923004

Discussion:
https://codereview.chromium.org/2852923004/diff/80001/gpu/command_buffer/service/shader_manager_unittest.cc#newcode248

Bug:  716018 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ib015e1d174500c19865cf51f50e6803fa1997fbd
Reviewed-on: https://chromium-review.googlesource.com/508279
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#473367}
[modify] https://crrev.com/e9cc6305714c1a585bc5cf51d289fdf000070ea0/gpu/command_buffer/service/shader_manager_unittest.cc
[modify] https://crrev.com/e9cc6305714c1a585bc5cf51d289fdf000070ea0/gpu/command_buffer/service/test_helper.cc
[modify] https://crrev.com/e9cc6305714c1a585bc5cf51d289fdf000070ea0/gpu/command_buffer/service/test_helper.h

Sign in to add a comment