New issue
Advanced search Search tips

Issue 763190 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

WebGL shader compile error

Reported by esent...@gmail.com, Sep 8 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36

Steps to reproduce the problem:
Open http://esenthel.com/download/Temp/ChromeWebGLBug/Application.html

What is the expected behavior?
app should load

What went wrong?
Error accessing Shader "ShdBlurX2" in ShaderFile "Main".
Application.html:1237 Pixel Shader compilation failed:
Application.html:1237 WARNING: 0:2: 'GL_EXT_shadow_samplers' : extension is not supported
Application.html:1237 ERROR: 0:60: 'for' : Missing init declaration
Application.html:1237 Pixel Shader code:
Application.html:1237 #extension GL_EXT_shader_texture_lod:enable
Application.html:1237 #extension GL_EXT_shadow_samplers:enable
Application.html:1237 #ifdef GL_ES
Application.html:1237 #define LP lowp
Application.html:1237 #define MP mediump
Application.html:1237 #define HP highp
Application.html:1237 precision HP float;
Application.html:1237 precision HP int;
Application.html:1237 precision HP sampler2D;
Application.html:1237 #if __VERSION__<300
Application.html:1237 #define texture2DLod texture2DLodEXT
Application.html:1237 #endif
Application.html:1237 #else
Application.html:1237 #define LP
Application.html:1237 #define MP
Application.html:1237 #define HP
Application.html:1237 #endif
Application.html:1237 #if __VERSION__>=300
Application.html:1237 #define texture2DLod textureLod
Application.html:1237 layout(location=0) out HP vec4 RT0;
Application.html:1237 #define varying in
Application.html:1237 #else
Application.html:1237 #define RT0 gl_FragData[0]
Application.html:1237 #define gl_InstanceID 0
Application.html:1237 #endif
Application.html:1237 varying vec4 GL_Tex0;
Application.html:1237 vec4 _ret_0;
Application.html:1237 vec4 _c0160;
Application.html:1237 vec4 _c0162;
Application.html:1237 float _w0164;
Application.html:1237 vec4 _c0168;
Application.html:1237 float _w0170;
Application.html:1237 float _delta0172;
Application.html:1237 float _x0176;
Application.html:1237 float _TMP177;
Application.html:1237 float _b0182;
Application.html:1237 vec4 _c0184;
Application.html:1237 uniform vec4 ColSize;
Application.html:1237 uniform vec4 ProjMatrix[4];
Application.html:1237 uniform sampler2D Col;
Application.html:1237 uniform sampler2D Depth;
Application.html:1237 uniform float DepthWeightScale;
Application.html:1237 void main()
Application.html:1237 {
Application.html:1237 float _weight;
Application.html:1237 float _color8;
Application.html:1237 float _z;
Application.html:1237 vec2 _dw_mad1;
Application.html:1237 vec2 _t;
Application.html:1237 int _i1;
Application.html:1237 _weight=5.00000000E-001;
Application.html:1237 _c0160=vec4(GL_Tex0.x,GL_Tex0.y,0.00000000E+000,0.00000000E+000);
Application.html:1237 _color8=texture2DLod(Col,vec2(_c0160.x,_c0160.y),_c0160.w).x*5.00000000E-001;
Application.html:1237 _c0162=vec4(GL_Tex0.x,GL_Tex0.y,0.00000000E+000,0.00000000E+000);
Application.html:1237 _w0164=texture2DLod(Depth,vec2(_c0162.x,_c0162.y),_c0162.w).x;
Application.html:1237 _w0164=_w0164*2.00000000E+000-1.00000000E+000;
Application.html:1237 _z=ProjMatrix[2].w/(_w0164-ProjMatrix[2].z);
Application.html:1237 _dw_mad1=vec2(-1.00000000E+000/(_z*DepthWeightScale+4.00000019E-003),2.00000000E+000);
Application.html:1237 _i1=-2;
Application.html:1237 for(;_i1<=2;_i1=_i1+1){
Application.html:1237 if(bool(_i1)){
Application.html:1237 _t.x=ColSize.x*(float((2*_i1))+(_i1>0?-5.00000000E-001:5.00000000E-001))+GL_Tex0.x;
Application.html:1237 _c0168=vec4(_t.x,GL_Tex0.y,0.00000000E+000,0.00000000E+000);
Application.html:1237 _w0170=texture2DLod(Depth,vec2(_c0168.x,_c0168.y),_c0168.w).x;
Application.html:1237 _w0170=_w0170*2.00000000E+000-1.00000000E+000;
Application.html:1237 _delta0172=_z-ProjMatrix[2].w/(_w0170-ProjMatrix[2].z);
Application.html:1237 _x0176=abs(_delta0172)*_dw_mad1.x+_dw_mad1.y;
Application.html:1237 _b0182=min(1.00000000E+000,_x0176);
Application.html:1237 _TMP177=max(0.00000000E+000,_b0182);
Application.html:1237 _c0184=vec4(_t.x,GL_Tex0.y,0.00000000E+000,0.00000000E+000);
Application.html:1237 _color8=_color8+_TMP177*texture2DLod(Col,vec2(_c0184.x,_c0184.y),_c0184.w).x;
Application.html:1237 _weight=_weight+_TMP177;
2Application.html:1237 }
Application.html:1237 _ret_0=vec4(_color8/_weight,_color8/_weight,_color8/_weight,_color8/_weight);
Application.html:1237 RT0=_ret_0;
Application.html:1237 return;
Application.html:1237 }

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.79  Channel: stable
OS Version: 10.0
Flash Version: 

From my understanding this is completely legal:
_i1=-2;
for(;_i1<=2;_i1=_i1+1){
But I get ERROR: 'for' : Missing init declaration

I can run this shader on desktop OpenGL Windows/Mac/Linux,
I can also run this shader on OpenGL ES 2/3 Android/iOS.
But not on Chrome WebGL.
 

Comment 1 by esent...@gmail.com, Sep 8 2017

See https://www.khronos.org/registry/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf

12.25 While-loop Declarations
What is the purpose of allowing variable declarations in a while statement?
while (bool b = f()) {...}
Boolean b will always be true until the point where it is destroyed. It is useful in C++ since integers are
implicitly converted to booleans.
RESOLUTION: Keep this behavior. Will be required if implicit type conversion is added to a future
version.
A similar issue exists in for-loops. The grammar allows constructs such as
for(;bool x = a < b;) ;

An example is provided where for has no init, but even has a variable declared in the loop-condition.
This looks like completely legal thing to do.
This could be system specific. Please provide your system info by
copying+pasting the full contents of chrome://gpu into a comment here.

Comment 3 by esent...@gmail.com, Sep 8 2017

I have a Windows 10 laptop with GeForce 650m GT and Intel HD 4000.

Note: To properly save this page, select the "Webpage, Complete" option in the Save File dialog.
Graphics Feature Status
Canvas: Hardware accelerated
CheckerImaging: Disabled
Flash: Hardware accelerated
Flash Stage3D: Hardware accelerated
Flash Stage3D Baseline profile: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Native GpuMemoryBuffers: Software only. Hardware acceleration disabled
Rasterization: Hardware accelerated
Video Decode: Hardware accelerated
Video Encode: Hardware accelerated
WebGL: Hardware accelerated
WebGL2: Hardware accelerated
Driver Bug Workarounds
clear_uniforms_before_first_program_use
decode_encode_srgb_for_generatemipmap
disable_accelerated_vpx_decode
disable_discard_framebuffer
disable_framebuffer_cmaa
disable_larger_than_screen_overlays
exit_on_context_lost
force_cube_complete
msaa_is_slow
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
ANGLE crash on glReadPixels from incomplete cube map texture: 518889
Applied Workarounds: force_cube_complete
On Intel GPUs MSAA performance is not acceptable for GPU rasterization: 527565
Applied Workarounds: msaa_is_slow
Framebuffer discarding can hurt performance on non-tilers: 570897
Applied Workarounds: disable_discard_framebuffer
Limited enabling of Chromium GL_INTEL_framebuffer_CMAA: 535198
Applied Workarounds: disable_framebuffer_cmaa
Disable KHR_blend_equation_advanced until cc shaders are updated: 661715
Decode and Encode before generateMipmap for srgb format textures on Windows: 634519
Applied Workarounds: decode_encode_srgb_for_generatemipmap
Accelerated VPx decoding is hanging on some videos.: 654111
Applied Workarounds: disable_accelerated_vpx_decode
Overlay sizes bigger than screen aren't accelerated on some Intel drivers: 720059
Applied Workarounds: disable_larger_than_screen_overlays
Native GpuMemoryBuffers have been disabled, either via about:flags or command line.
Disabled Features: native_gpu_memory_buffers
Checker-imaging has been disabled via finch trial or the command line.
Disabled Features: checker_imaging
Version Information
Data exported	9/8/2017, 2:09:49 PM
Chrome version	Chrome/61.0.3163.79
Operating system	Windows NT 10.0.15063
Software rendering list version	13.10
Driver bug list version	10.28
ANGLE commit id	0d2ecb4ea992
2D graphics backend	Skia/61 0eefc0552cfb5ac077560b7c2630c5bd475ea585-
Command Line	"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --flag-switches-begin --flag-switches-end
Driver Information
Initialization time	328
In-process GPU	false
Passthrough Command Decoder	false
Supports overlays	false
Sandboxed	false
GPU0	VENDOR = 0x8086, DEVICE= 0x0166 *ACTIVE*
GPU1	VENDOR = 0x10de, DEVICE= 0x0fd1
Optimus	false
Optimus	false
AMD switchable	false
Desktop compositing	Aero Glass
Diagonal Monitor Size of \\.\DISPLAY1	15.5"
Driver vendor	Intel Corporation
Driver version	10.18.10.4358
Driver date	12-21-2015
Pixel shader version	5.0
Vertex shader version	5.0
Max. MSAA samples	8
Machine model name	
Machine model version	
GL_VENDOR	Google Inc.
GL_RENDERER	ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)
GL_VERSION	OpenGL ES 3.0 (ANGLE 2.1.0.0d2ecb4ea992)
GL_EXTENSIONS	GL_ANGLE_client_arrays GL_ANGLE_depth_texture GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_instanced_arrays GL_ANGLE_lossy_etc_decode GL_ANGLE_pack_reverse_row_order GL_ANGLE_program_cache_control GL_ANGLE_request_extension GL_ANGLE_robust_client_memory GL_ANGLE_robust_resource_initialization GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ANGLE_texture_usage GL_ANGLE_translated_shader_source GL_CHROMIUM_bind_generates_resource GL_CHROMIUM_bind_uniform_location GL_CHROMIUM_color_buffer_float_rgb GL_CHROMIUM_color_buffer_float_rgba GL_CHROMIUM_copy_compressed_texture GL_CHROMIUM_copy_texture GL_CHROMIUM_sync_query GL_EXT_blend_minmax GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_disjoint_timer_query GL_EXT_draw_buffers GL_EXT_frag_depth GL_EXT_map_buffer_range GL_EXT_occlusion_query_boolean GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_sRGB GL_EXT_shader_texture_lod GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc_srgb GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_norm16 GL_EXT_texture_rg GL_EXT_texture_storage GL_EXT_unpack_subimage GL_KHR_debug GL_NV_EGL_stream_consumer_external GL_NV_fence GL_NV_pack_subimage GL_NV_pixel_buffer_object GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth32 GL_OES_element_index_uint GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object
Disabled Extensions	GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent
Window system binding vendor	Google Inc. (adapter LUID: 0000000000008390)
Window system binding version	1.4 (ANGLE 2.1.0.0d2ecb4ea992)
Window system binding extensions	EGL_EXT_create_context_robustness EGL_ANGLE_d3d_share_handle_client_buffer EGL_ANGLE_d3d_texture_client_buffer EGL_ANGLE_surface_d3d_texture_2d_share_handle EGL_ANGLE_query_surface_pointer EGL_ANGLE_window_fixed_size EGL_ANGLE_keyed_mutex EGL_ANGLE_surface_orientation EGL_ANGLE_direct_composition 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_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_get_all_proc_addresses EGL_KHR_stream EGL_KHR_stream_consumer_gltexture EGL_NV_stream_consumer_gltexture_yuv EGL_ANGLE_flexible_surface_compatibility EGL_ANGLE_stream_producer_d3d_texture_nv12 EGL_ANGLE_create_context_webgl_compatibility EGL_CHROMIUM_create_context_bind_generates_resource EGL_CHROMIUM_sync_control EGL_EXT_pixel_format_float EGL_KHR_surfaceless_context EGL_ANGLE_display_texture_share_group EGL_ANGLE_create_context_client_arrays EGL_ANGLE_program_cache_control
Direct rendering	Yes
Reset notification strategy	0x8252
GPU process crash count	0
Compositor Information
Tile Update Mode	One-copy
Partial Raster	Enabled
GpuMemoryBuffers Status
ATC	Software only
ATCIA	Software only
DXT1	Software only
DXT5	Software only
ETC1	Software only
R_8	Software only
R_16	Software only
RG_88	Software only
BGR_565	Software only
RGBA_4444	Software only
RGBX_8888	Software only
RGBA_8888	Software only
BGRX_8888	Software only
BGRA_8888	Software only
RGBA_F16	Software only
YVU_420	Software only
YUV_420_BIPLANAR	Software only
UYVY_422	Software only
Diagnostics
... loading ...
Log Messages
[22232:43956:0908/113306.430:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(69,10-34): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them C:\fakepath(91,10-34): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:42516:0908/120211.650:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(60,9-50): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:42516:0908/120211.800:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(60,24-42): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:42516:0908/120243.327:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(103,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:42516:0908/120243.355:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(110,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/123937.620:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(103,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/123937.662:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(110,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/123937.774:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(103,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/123937.814:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(110,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/130324.700:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(589,28-80): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/130326.530:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(589,28-80): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45400:0908/130326.751:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(334,8-66): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:45820:0908/130327.656:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(334,8-66): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:28540:0908/135841.989:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(103,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:28540:0908/135842.023:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(110,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:28540:0908/135842.111:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(103,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:28540:0908/135842.148:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(110,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[22232:28540:0908/135844.282:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(94,35-87): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
GpuProcessHostUIShim: The GPU process exited normally. Everything is okay.
This is not a bug, see https://www.khronos.org/registry/webgl/specs/latest/1.0/#SUPPORTED_GLSL_CONSTRUCTS

for loops must conform to the structural constraints in Appendix A.

looking in the glsl 1.00 spec:

* The for statement has the form:
for ( init-declaration ; condition ; expression ) statement
• init-declaration has the form:
type-specifier identifier = constant-expression

The key here is you're using GLSL 1.00. If you want GLSL ES 3.00 use #version 300 es. This 1.00 validation code has been in ANGLE for a long time.
Status: WontFix (was: Unconfirmed)

Sign in to add a comment