mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
101.98k stars 35.33k forks source link

Undeclared identifier 'IncidentLight' on Windows #8161

Closed kozec closed 8 years ago

kozec commented 8 years ago

Hello,

I encountered weird, platform dependent problem, with most of default shaders. Everything works nice and dandy in Chromium on my Linux PC, but Chrome 49.0.2594.3 canary (64-bit) on Windows 7 fails to compile shaders with following log:

(index):218 GET http://www.google-analytics.com/ga.js net::ERR_BLOCKED_BY_CLIENT(anonymous function) @ (index):218(anonymous function) @ (index):219
(index):421     __     __
 __/ __\  / __\__   ____   _____   _____
/ __/  /\/ /  /___\/ ____\/ _____\/ _____\
\/_   __/ /   _   / /  __/ / __  / / __  /_   __   _____
/ /  / / /  / /  / /  / / /  ___/ /  ___/\ _\/ __\/ _____\
\/__/  \/__/\/__/\/__/  \/_____/\/_____/\/__/ /  / /  ___/
                                         / __/  /  \__  \
                                         \/____/\/_____/
three.min.js:639 THREE.WebGLRenderer 74
three.min.js:707 THREE.WebGLProgram: shader error:  0 gl.VALIDATE_STATUS false gl.getProgramInfoLog C:\fakepath(249,9-30): error X3004: undeclared identifier 'IncidentLight'

Warning: D3D shader compilation failed with default flags. (vs_3_0)
 Retrying with avoid flow control
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_45daf4aa877f103d'

Warning: D3D shader compilation failed with avoid flow control flags. (vs_3_0)
 Retrying with prefer flow control
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_45daf4aa877f103d'

Warning: D3D shader compilation failed with prefer flow control flags. (vs_3_0)
Failed to create D3D shaders.
  (anonymous function) @ three.min.js:707acquireProgram @ three.min.js:716t @ three.min.js:605renderBufferDirect @ three.min.js:651s @ three.min.js:603render @ three.min.js:663render @ material-browser.html:108(anonymous function) @ material-browser.html:121
three.min.js:608 WebGL: INVALID_OPERATION: useProgram: program not valid
three.min.js:678 WebGL: INVALID_OPERATION: drawArrays: no valid shader program in use
254three.min.js:678 WebGL: INVALID_OPERATION: drawArrays: no valid shader program in use
three.min.js:678 WebGL: too many errors, no more errors will be reported to the console for this context.

Problem is visible even on threejs.org doc pages, for example at http://threejs.org/docs/#Reference/Materials/MeshLambertMaterial

As far as I'm able to tell, 'IncidentLight' structure is defined in common.glsl and it is included in generated shader.

// Edit: here is generated fragment and generated vertex shader

kozec commented 8 years ago

I somehow managed to fix the problem;

Compilation fails on functions IncidentLight getPointDirectLight and IncidentLight getDirectionalDirectLight. Modifying those functions to void types that modifies argument, as in

void getDirectionalDirectLight( out IncidentLight directLight, const in DirectionalLight directionalLight, const in GeometricContext geometry );

void getPointDirectLight( out IncidentLight directLight, const in PointLight pointLight, const in GeometricContext geometry );

has same effect and compiles fine on Windows.

mrdoob commented 8 years ago

/ping @bhouston @WestLangley

mrdoob commented 8 years ago

Sounds like a compiler bug though.

bhouston commented 8 years ago

I completely agree with @mrdoob, it is a compiler bug.

This is a Canary build of Chrome, I'd report this to the Chromium project right away so that this bug does't make it into the beta and production builds of Chrome:

https://code.google.com/p/chromium/issues/list

I tried it on Canary Version 50.0.2654.0 canary (64-bit) on Windows 10 with a NVIDIA GeForce 980 and it didn't produce an error on the MeshLambertMaterial page you directed us to. I suspect the issue is related to a combination of video card + ANGLE version?

kozec commented 8 years ago

This is a Canary build of Chrome, I'd report this to the Chromium project right away so that this bug does't make it into the beta and production builds of Chrome

Same thing happens with Firefox, by the way.

    __     __
 __/ __\  / __\__   ____   _____   _____
/ __/  /\/ /  /___\/ ____\/ _____\/ _____\
\/_   __/ /   _   / /  __/ / __  / / __  /_   __   _____
/ /  / / /  / /  / /  / / /  ___/ /  ___/\ _\/ __\/ _____\
\/__/  \/__/\/__/\/__/  \/_____/\/_____/\/__/ /  / /  ___/
                                         / __/  /  \__  \
                                         \/____/\/_____/ docs:421:1
THREE.WebGLRenderer 74 three.min.js:639:410
Error: WebGL: linkProgram: Failed to link, leaving the following log:
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_608c5a4366927304'

Warning: D3D shader compilation failed with default flags.
 Retrying with avoid flow control
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_608c5a4366927304'

Warning: D3D shader compilation failed with avoid flow control flags.
 Retrying with prefer flow control
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_608c5a4366927304'

Warning: D3D shader compilation failed with prefer flow control flags.
Failed to create D3D shaders.

 three.min.js:707:242
THREE.WebGLProgram: shader error:  0 gl.VALIDATE_STATUS false gl.getProgramInfoLog C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_608c5a4366927304'

Warning: D3D shader compilation failed with default flags.
 Retrying with avoid flow control
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_608c5a4366927304'

Warning: D3D shader compilation failed with avoid flow control flags.
 Retrying with prefer flow control
C:\fakepath(249,9-30): error X3004: undeclared identifier 'webgl_608c5a4366927304'

Warning: D3D shader compilation failed with prefer flow control flags.
Failed to create D3D shaders.
   three.min.js:707:391

Error: WebGL: useProgram: Program has not been successfully linked. three.min.js:608:40
Error: WebGL: drawArrays: null CURRENT_PROGRAM three.min.js:678:105
Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings) three.min.js:678:105

Windows 7, Firefox 44 @ http://threejs.org/docs/#Reference/Materials/MeshLambertMaterial

mrdoob commented 8 years ago

What graphics card is that with?

bhouston commented 8 years ago

Works for me in FF 44. Try in IE. If it works in IE, then it is likely related to the ANGLE project which Google manages and is used by FF and Chrome to implement WebGL -> DirectX, but ANGLE is not used by IE.

kozec commented 8 years ago

What graphics card is that with?

NVidia Quadro 600

If it works in IE

Sorry, only IE I have available here is IE8... I doubt I'd get anything better than BSOD from it :)

mrdoob commented 8 years ago

Sorry, only IE I have available here is IE8... I doubt I'd get anything better than BSOD from it :)

Oh... :(

bhouston commented 8 years ago

Windows 7 supports IE 11. https://blogs.msdn.microsoft.com/ie/2013/11/07/ie11-for-windows-7-globally-available-for-consumers-and-businesses/

But if you are getting BSOD on IE then maybe something is not well with your computer in general.

kozec commented 8 years ago

But if you are getting BSOD on IE then maybe something is not well with your computer in general.

That was a joke, sorry. I have only one Windows machine and I have to keep IE8 there, but I'll try to get something with different videocard to check if problem isn't NVidia (Quadro) related.

bhouston commented 8 years ago

The NVIDIA Quadro 600 is mostly equivalent to a GeFroce 4xx series which generally is a decent GPU series. I do not think it is a GPU issue but rather a driver/ANGLE issue.

I'd suggest reporting the bug to the ANGLE project:

https://github.com/google/angle

kozec commented 8 years ago

Ok, so IE11 on nearly identical machine and W7 throws even weirder error:

  THREE.WebGLShader: Shader couldn't compile.
   THREE.WebGLShader: gl.getShaderInfoLog() fragment Shader compilation errors
(25, 1): syntax error, unexpected UNSUPPORTED_TOKEN

Line 25: struct IncidentLight {

http://pastebin.com/MVPKNjRx

Still on http://threejs.org/docs/#Reference/Materials/MeshLambertMaterial

I'm afraid my webgl skills are not good enough even to create minimal sample without Three.js, but I'll check what can be mashed together :)

mrdoob commented 8 years ago

And you have the latest drivers, right?

kozec commented 8 years ago

361.91, updated as first thing when problem occurred.

RemusMar commented 8 years ago

NVidia Quadro 600

I cannot replicate your issue on 3 different systems: Nvidia GTS 450, GTX 760 and GTX 980 Firefox 44 and Chrome 48 One of the computers is dual boot: Win 7 and Win 8. cheers

mrdoob commented 8 years ago

@kenrussell is this a known bug?

kozec commented 8 years ago

I tested for issue with W7 on Intel HD 5500 and GTX750 and, indeed, it works at expected there.

Here is issue on Angleproject that may be related.

GLSL compiler on Quatro sometimes works... well, different, so it may be card and platform dependent problem. I have fix for my case, so if you don't feel like supporting outdated and rather rare card, feel free to close issue.

bhouston commented 8 years ago

I have fix for my case, so if you don't feel like supporting outdated and rather rare card, feel free to close issue.

We want to support everything, but it is really really hard to support compiler bugs. With compiler bugs we need to report the issues and get them fixed at the appropriate level -- ANGLE or NVIDIA driver.

BTW @RemusMar one thing I learned from debugging a ton of Quadro issues is that the cheapest way to do that is to look up the chip model here: https://en.wikipedia.org/wiki/Nvidia_Quadro And you can see the Quadro 600 has a GF108GL GPU. Then you can find the GeForce card with the same GPU and buy it. In this case it would be the NVIDIA GeForce GT 420, GT 430, and GT 440, as you can see from this page's GPU listing:

https://en.wikipedia.org/wiki/GeForce_400_series

Every time I found the exact NVIDIA GeForce equivalent to a Quadro I was able to reproduce successfully - this may not be 100% of the time but it is close to that. I think it is because NVIDIA shares the drivers between the cards with the exact same GPU model.

This is actually a really rare GPU, which is why likely no one noticed this bug before.

RemusMar commented 8 years ago

BTW @RemusMar one thing I learned from debugging a ton of Quadro issues is that the cheapest way to do that is to look up the chip model here

I use Nvidia graphic cards since TNT Vanta. Better performances and less bugs compared to ATI / AMD. But I did never like their Quadro series (and never recommended to our customers).

cheers

kenrussell commented 8 years ago

Sorry, can not reproduce with Chrome Canary on a workstation with the same graphics card. Here's about:gpu from the workstation:

http://pastebin.com/iDrdZaQC

My best recommendation would be for you to look into updating your graphics drivers.

MasterJames commented 8 years ago

I read somewhere that the Quadro is for higher end or pro grade application support (double price too) but the only difference is the pro grade double checks for accuracy while the other performance is faster but has tiny random errors and the other one is a cleaner render for pro usage but that the drivers were interchangeable and the hardware the same. I read about it pertaining to Houdini compatibility and thought if it doesnt work I'll follow the driver switch hack the article described but it worked fine with the non-pro card or should I say driver so I never needed to make the change. This was with the titan or is it called titanium a few years back now. Anyway the details are not important. Its just the point that the hardware was the same and the drivers did a little bit different efficiency preference (quality vs speed) but are in theory interchangeable despite the price being twice as much.

kozec commented 8 years ago

@kenrussell Here is mine about:gpu and here is the comparison - about:gpu from machine when stuff is failing is on right

Biggest difference I see is that your driver is older and mine uses DX9 for whatever reason.

// edit: Another comparison without --ignore-gpu-blacklist, just to confirm that it isn't cause of problem.

bhouston commented 8 years ago

Yourfs has ignore software blacklist. That is dangerous. You should remove that to see if that fixes the error. On Feb 22, 2016 4:24 AM, "kozec" notifications@github.com wrote:

@kenrussell https://github.com/kenrussell Here is mine about:gpu http://pastebin.com/qqrg6Tfm and here is the comparison https://www.diffchecker.com/1dsv1oxt

Biggest difference I see is that your driver is older and mine uses DX9 for whatever reason.

— Reply to this email directly or view it on GitHub https://github.com/mrdoob/three.js/issues/8161#issuecomment-187088126.

kozec commented 8 years ago

I guess edits are not included in mails, so, as I edited few minutes after that post;:

Here is another comparison without --ignore-gpu-blacklist, just to confirm that it isn't cause of problem.

http://threejs.org/docs/#Reference/Materials/MeshLambertMaterial doesn't work without --ignore-gpu-blacklist as well and error message is very same.

RemusMar commented 8 years ago

http://threejs.org/docs/#Reference/Materials/MeshLambertMaterial

This particular sample does not work on one of my systems (GTS 450). I get black screen and:

Warning: D3D shader compilation failed with prefer flow control flags. Failed to create D3D shaders.

Tested with Firefox 44. So obviously, there is something wrong with the MeshLambertMaterial in Three.js

kenrussell commented 8 years ago

@kozec : the bottom of your about:gpu log points out: ANGLE Display::initialize error 5: DXGI 1.2 required to present to HWNDs owned by another process.

You need to take the associated system update and then ANGLE's D3D11 code path will work. Alternatively, update to either Windows 8.x or Windows 10.

kozec commented 8 years ago

Looking at that reference above, upgrade is probably not gonna help... I'll test it with DXGI.

kozec commented 8 years ago

Ok, I can confirm that after installing "Platform update", Chrome to uses DX11 renderer _(ANGLE (NVIDIA Quadro 600 Direct3D11 vs_5_0 ps_50)) and MeshLambertMaterial example renders fine in both Chrome and Firefox.

Example referenced in #8200 still fails in chrome, but that's probably different issue.

StarPlugins commented 8 years ago

I tested this further on some other devices in Chrome:

HP Win10 laptop - OK Toshiba Win10 Laptop - OK Acer Chromebook - OK

So, it looks like my Samsung laptop (about 2.5 years old) is causing problems, although I'm sure I've seen the example in question working properly in the past on the same laptop - I'll check that.

For what it's worth, here's the Chrome GPU dump from that Samsung machine:

Graphics Feature Status Canvas: Hardware accelerated Flash: Hardware accelerated Flash Stage3D: Hardware accelerated Flash Stage3D Baseline profile: Hardware accelerated Compositing: Hardware accelerated Multiple Raster Threads: Enabled Rasterization: Software only. Hardware acceleration disabled Video Decode: Hardware accelerated Video Encode: Hardware accelerated WebGL: Hardware accelerated Driver Bug Workarounds clear_uniforms_before_first_program_use disable_d3d11 exit_on_context_lost force_cube_complete scalarize_vec_and_mat_constructor_args texsubimage_faster_than_teximage Problems Detected Some drivers are unable to reset the D3D device in the GPU process sandbox Applied Workarounds: exit_on_context_lost TexSubImage is faster for full uploads on ANGLE Applied Workarounds: texsubimage_faster_than_teximage Clear uniforms before first program use on all platforms: 124764, 349137 Applied Workarounds: clear_uniforms_before_first_program_use Always rewrite vec/mat constructors to be consistent: 398694 Applied Workarounds: scalarize_vec_and_mat_constructor_args Disable Direct3D11 on systems with AMD switchable graphics: 451420 Applied Workarounds: disable_d3d11 ANGLE crash on glReadPixels from incomplete cube map texture: 518889 Applied Workarounds: force_cube_complete Accelerated rasterization has been disabled, either via about:flags or command line. Disabled Features: rasterization GpuMemoryBuffer Status ATC Software only ATCIA Software only DXT1 Software only DXT5 Software only ETC1 Software only R_8 Software only RGBA_4444 Software only RGBX_8888 Software only RGBA_8888 Software only BGRX_8888 Software only BGRA_8888 Software only YUV_420 Software only YUV_420_BIPLANAR Software only UYVY_422 Software only Version Information Data exported 23/02/2016, 09:40:02 Chrome version Chrome/48.0.2564.116 Operating system Windows NT 10.0 Software rendering list version 10.16 Driver bug list version 8.32 ANGLE commit id 5576734a46f8 2D graphics backend Skia Command Line Args Files (x86)\Google\Chrome\Application\chrome.exe" --flag-switches-begin --enable-devtools-experiments --flag-switches-end Driver Information Initialization time 141 In-process GPU false Sandboxed false GPU0 VENDOR = 0x1002, DEVICE= 0x6821 GPU1 VENDOR = 0x8086, DEVICE= 0x0166 Optimus false AMD switchable true Desktop compositing Aero Glass Driver vendor Advanced Micro Devices, Inc. Driver version 15.200.1065.0 Driver date 7-21-2015 Pixel shader version 3.0 Vertex shader version 3.0 Max. MSAA samples 8 Machine model name
Machine model version
GL_VENDOR Google Inc. GL_RENDERER ANGLE (Intel(R) HD Graphics 4000 Direct3D9Ex vs_3_0 ps_3_0) GL_VERSION OpenGL ES 2.0 (ANGLE 2.1.0.5576734a46f8) GL_EXTENSIONS GL_OES_element_index_uint GL_OES_packed_depth_stencil GL_OES_get_program_binary GL_OES_rgb8_rgba8 GL_EXT_texture_format_BGRA8888 GL_EXT_read_format_bgra GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_float GL_OES_texture_float_linear GL_EXT_texture_compression_dxt1 GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ANGLE_depth_texture GL_EXT_texture_storage GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_occlusion_query_boolean GL_NV_fence GL_EXT_robustness GL_EXT_blend_minmax GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_instanced_arrays GL_ANGLE_pack_reverse_row_order GL_OES_standard_derivatives GL_EXT_shader_texture_lod GL_EXT_frag_depth GL_ANGLE_texture_usage GL_ANGLE_translated_shader_source GL_EXT_debug_marker GL_OES_EGL_image GL_EXT_unpack_subimage GL_NV_pack_subimage GL_OES_vertex_array_object Disabled Extensions Window system binding vendor Google Inc. (adapter LUID: 000000000000668e) Window system binding version 1.4 (ANGLE 2.1.0.5576734a46f8) Window system binding extensions EGL_EXT_create_context_robustness EGL_ANGLE_d3d_share_handle_client_buffer EGL_ANGLE_surface_d3d_texture_2d_share_handle EGL_ANGLE_query_surface_pointer EGL_ANGLE_window_fixed_size EGL_NV_post_sub_buffer EGL_KHR_create_context EGL_EXT_device_query EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_renderbuffer_image EGL_KHR_get_all_proc_addresses Direct rendering Yes Reset notification strategy 0x8252 GPU process crash count 0 Diagnostics 0 b3DAccelerationEnabled true b3DAccelerationExists true bAGPEnabled true bAGPExistenceValid true bAGPExists true bCanRenderWindow true bDDAccelerationEnabled true bDriverBeta false bDriverDebug false bDriverSigned false bDriverSignedValid false bNoHardware false dwBpp 32 dwDDIVersion 11 dwHeight 1080 dwRefreshRate 60 dwWHQLLevel 0 dwWidth 1920 iAdapter 0 lDriverSize 11053048 lMiniVddSize 0 szAGPStatusEnglish Enabled szAGPStatusLocalized Enabled szChipType Intel(R) HD Graphics Family szD3DStatusEnglish Enabled szD3DStatusLocalized Enabled szDACType Internal szDDIVersionEnglish 11.2 szDDIVersionLocalized 11.2 szDDStatusEnglish Enabled szDDStatusLocalized Enabled szDXVAHDEnglish Supported szDXVAModes ModeMPEG2_A ModeMPEG2_C ModeWMV9_C ModeVC1_C szDescription Intel(R) HD Graphics 4000 szDeviceId 0x0166 szDeviceIdentifier {D7B78E66-4226-11CF-4967-ECE0B4C2C735} szDeviceName .\DISPLAY1 szDisplayMemoryEnglish 1792 MB szDisplayMemoryLocalized 1792 MB szDisplayModeEnglish 1920 x 1080 (32 bit) (60Hz) szDisplayModeLocalized 1920 x 1080 (32 bit) (60Hz) szDriverAssemblyVersion 10.18.10.4276 szDriverAttributes Final Retail szDriverDateEnglish 17/08/2015 00:00:00 szDriverDateLocalized 8/17/2015 00:00:00 szDriverLanguageEnglish English szDriverLanguageLocalized English szDriverModelEnglish WDDM 1.3 szDriverModelLocalized WDDM 1.3 szDriverName igdumdim64.dll,igd10iumd64.dll,igd10iumd64.dll,igdumdim32,igd10iumd32,igd10iumd32 szDriverNodeStrongName oem44.inf:5f63e5341859ec8c:iIVBM_w10:10.18.10.4276:pci\ven_8086&dev_0166 szDriverSignDate
szDriverVersion 10.18.0010.4276 szKeyDeviceID Enum\PCI\VEN_8086&DEV_0166&SUBSYS_C0E6144D&REV_09 szKeyDeviceKey \Registry\Machine\System\CurrentControlSet\Control\Video{9393676C-E44A-49E6-9DF5-AA26D25AF09A}\0000 szManufacturer Intel Corporation szMiniVdd n/a szMiniVddDateEnglish n/a szMiniVddDateLocalized n/a szMonitorMaxRes szMonitorName Generic PnP Monitor szNotesEnglish No problems found. szNotesLocalized No problems found. szOverlayEnglish Supported szRankOfInstalledDriver 00D12001 szRegHelpText
szRevision
szRevisionId 0x0009 szSubSysId 0xC0E6144D szTestResultD3D7English Not run szTestResultD3D7Localized Not run szTestResultD3D8English Not run szTestResultD3D8Localized Not run szTestResultD3D9English Not run szTestResultD3D9Localized Not run szTestResultDDEnglish Not run szTestResultDDLocalized Not run szVdd n/a szVendorId 0x8086 Log Messages GpuProcessHostUIShim: The GPU process exited normally. Everything is okay.

kozec commented 8 years ago

Disable Direct3D11 on systems with AMD switchable graphics: 451420 Applied Workarounds: disable_d3d11 (...) GL_RENDERER ANGLE (Intel(R) HD Graphics 4000 Direct3D9Ex vs_3_0 ps_3_0)

So, basically, compilation fails on Windows, if ANGLE translates GLSL to HLSL and then tries to compile it using DX9 compiler.

Problem is that I, as "web developer" / Three.js user don't have any way how to predict when DX9 compiler is gonna be used.

RemusMar commented 8 years ago

I'm sure I've seen the example in question working properly in the past on the same laptop

Yes , that's true. That's why I said that there is something wrong with MeshLambertMaterial in Three.js

So, basically, compilation fails on Windows, if ANGLE translates GLSL to HLSL and then tries to compile it using DX9 compiler.

It worked on DX9 and DX11, now it works on DX11 only.

curiouspers commented 8 years ago

Can confirm this bug on win7, chrome 48.0.2564.116 m, Nvidia GT 640, what interesting that on this page: http://mrdoob.github.io/three.js/examples/webgl_interactive_cubes.html there is no error.

Frankling commented 8 years ago

I have met the same problem on this, it works on FF, and didn't work on chrome, (version r74 and r75) ,but when i use version r73, it works fine,my graphic card is NVIDIA GeForce GT 650M THREE.WebGLProgram: shader error: 0 gl.VALIDATE_STATUS false gl.getProgramInfoLog C:\fakepath(322,9-30): error X3004: undeclared identifier 'IncidentLight'

doexclusive commented 8 years ago

NVIDIA GeForce GT640M same problem ( Windows 7 64 bit, Chrome, current 49.0.2623.87 m and few prev versions ) since r74, still in r75 and r76dev.

On the MacBook Air works perfect.

This problem can be reproduced visiting these pages: http://threejs.org/examples/#webgl_materials_cubemap_dynamic, http://threejs.org/examples/#webgl_materials_cars

VM47 three.min.js:704 THREE.WebGLProgram: shader error: 0 gl.VALIDATE_STATUS false gl.getProgramInfoLog C:\fakepath(319,9-30): error X3004: undeclared identifier 'IncidentLight'

Warning: D3D shader compilation failed with default flags. (vs_3_0) Retrying with avoid flow control C:\fakepath(319,9-30): error X3004: undeclared identifier 'webgl_45daf4aa877f103d'

Warning: D3D shader compilation failed with avoid flow control flags. (vs_3_0) Retrying with prefer flow control C:\fakepath(319,9-30): error X3004: undeclared identifier 'webgl_45daf4aa877f103d'

Warning: D3D shader compilation failed with prefer flow control flags. (vs_3_0) Failed to create D3D shaders.

Cars not loading.

In my game mesh( wheel ) from BinaryLoader looks strange. Its multi-material mesh, has 3 materials. First and second materials are visible, last - no. image

Please, fix it to continue using new theejs versions

bhouston commented 8 years ago

@doexclusive Can you share your annotationed shader file from your console? I'd like to identify lines 319. It is a compiler bug but if I can find its line I can work around it.

Otherwise, does someone want to send me a card that can reproduce this? I am sure there are other formulations for this that I could try if I could reproduce it. Usually shader bugs just require the code to be in a different form.

What we really need is a cloud service that allows us to try on various different GPUs and web browsers via a remote session or something. That would be so useful. Each release of three.js we could run on various GPUs/browsers and create screenshots of each example. Then we would know the full robustness of our shaders.

doexclusive commented 8 years ago

@bhouston To get shader's source I used three.js r75. On the lines 29400 and 29401 I removed // and they are: console.log( 'VERTEX', vertexGlsl ); console.log( 'FRAGMENT', fragmentGlsl );

Here how looked my console: ( I copied text and splited it in few files )

content in file: http://st1.craziegames.com/a8/a/vertexShader.txt content in file: http://st1.craziegames.com/a8/a/fragmentShader.txt content in file: http://st1.craziegames.com/a8/a/errorInConsole.txt content in file: http://st1.craziegames.com/a8/a/vertexShader2.txt content in file: http://st1.craziegames.com/a8/a/fragmentShader2.txt

And this file ( http://st1.craziegames.com/a8/a/fullConsole.txt ) is full copy(without split) from my console.

This error happens only when I use MeshLambertMaterial, with MeshPhongMaterial everythig ok.

Frankling commented 8 years ago

Is anyone fixed this promblem now ?

bhouston commented 8 years ago

@doexclusive I have an idea on how to avoid the compiler error. I think that the issue may be that compiler may be having problems with a struct (IncidentLight in this case) being returned by a function as its return value. We could reformulate those functions so that they take an "out" function parameter of IncidentLight instead. This doesn't change the functionality at all, but it may allow us to work around what appears to be a compiler bug. I'll try to get this change done later today. The functions that I would change are getDirectionalDirectLightIrradiance, getPointDirectLightIrradiance, an getSpotDirectLightIrradiance.

mrdoob commented 8 years ago

@bhouston many thanks for taking a look at this!

kozec commented 8 years ago

@Frankling

Is anyone fixed this promblem now ?

I'm using fix that I described in https://github.com/mrdoob/three.js/issues/8161#issuecomment-185669502 since I reported this without problems.

bhouston commented 8 years ago

@kozec, why don't you PR that fix?

mrdoob commented 8 years ago

Isn't that risky? As far as I understand, that method doesn't return void, so I suspect that approach is likely to fail in other drivers/gpus?

bhouston commented 8 years ago

@kozec, @mrdoob, I've made a very quick stab at getting a PR in to fix this here: https://github.com/mrdoob/three.js/pull/8461

Test link to see if the fix works: http://ci.threejs.org/api/pullrequests/8461/examples/webgl_materials_envmaps_hdr.html

kozec commented 8 years ago

@bhouston

@kozec, why don't you PR that fix?

I was under impression that workarounding compiler bugs is not desired.

@mrdoob Doing this shouldn't break anything, void functions are perfectly normal and out parameters are part of gles 2.0. As long as it doesn't trigger another compiler bug, ofc :)

kenrussell commented 8 years ago

Not to speak for the Three.js developers, but minor tweaks to the shaders to make them run more portably seems like a good goal.

If there is an obvious bug in the handling of GLSL constructs in some WebGL implementations -- and it sounds like there is in this case -- please create a new WebGL conformance test by submitting a pull request against https://github.com/KhronosGroup/WebGL , adding a new test under sdk/tests/conformance/ , perhaps in this case in sdk/tests/conformance/glsl/bugs/ . That way it will have to be fixed for the next iterations of conformant WebGL implementations.

mrdoob commented 8 years ago

@kenrussell I've done a shadertoy repro here... https://www.shadertoy.com/view/lddXD8

Once @doexclusive @kozec and/or @Frankling confirm that it's a good repro, I'll do the conformance test.

kenrussell commented 8 years ago

Excellent. Thanks @mrdoob .