shairai / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

Codeflow Advanced WebGL - Part 1 Demo fails with ANGLE #300

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is filed on Behalf of https://bugzilla.mozilla.org/show_bug.cgi?id=680012

What steps will reproduce the problem?
1. load http://codeflow.org/entries/2011/apr/11/advanced-webgl-part-1/demo/
2. Receive Error instead of Rendering:

An unknown error occured
type: program link
error: (67,9): warning X3078: '_i': loop control variable conflicts with a 
previous declaration in the outer scope; most recent declaration will be used 
(67,5): warning X3557: loop only executes for 1 iteration(s), forcing loop to 
unroll (23,16): error X4507: maximum ps_3_0 constant register index (224) 
exceeded - Try reducing number of constants referenced
path: shaders/cubemap_convolve.shader
vendor: Mozilla
version: WebGL 1.0
maxVSTextureUnits: 4
user: 0f07ade34bf000ed2d8765014acd8619

+

Error Console Output:

Error: uncaught exception: [object Object]
 ----------
Error: not well-formed
Source file: 
http://codeflow.org/entries/2011/apr/11/advanced-webgl-part-1/demo/data/terrain/
mesh.vbo
Line: 1, Column: 1
Source code:
{"indices": [71, 39, 38, ......

What version of the product are you using? On what operating system?
ANGLE 1.0.0.963 on Firefox Trunk and ANGLE 1.0.0.985 on Google Chrome Canary on 
Windows 7 x64.

Running Chrome with "--use-gl=desktop" works (minus the FPS Counter).
Running Firefox with "webgl.prefer-native-gl;true" works too.

chrome://gpu/ Driver Info:
Initialization time 195
Vendor Id   0x1002
Device Id   0x9442
Optimus false
Driver vendor   
Driver version  8.930.0.0
Driver date 12-5-2011
Pixel shader version    3.0
Vertex shader version   3.0
GL version  
GL_VENDOR   
GL_RENDERER 
GL_VERSION  
GL_EXTENSIONS   

about:support Graphics Info:
Graphics
Adapter Description        ATI Radeon HD 4800 Series
Vendor ID        0x1002
Device ID        0x9442
Adapter RAM         512
Adapter Drivers        aticfx64 aticfx64 aticfx64 aticfx32 aticfx32 aticfx32 
atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
Driver Version        8.930.0.0
Driver Date        12-5-2011
Direct2D Enabled        true
DirectWrite Enabled        true (6.1.7601.17563)
ClearType Parameters        Gamma: 1800 Pixel Structure: RGB ClearType Level: 
100 Enhanced Contrast: 400
WebGL Renderer        Google Inc. -- ANGLE (ATI Radeon HD 4800 Series) -- 
OpenGL ES 2.0 (ANGLE 1.0.0.963)
GPU Accelerated Windows        1/1 Direct3D 10
AzureBackend        direct2d

Original issue reported on code.google.com by xtc4uall@gmail.com on 23 Feb 2012 at 9:13

GoogleCodeExporter commented 9 years ago
Unfortunately the primary problem is that the fragment shader failing to link 
because it is using too many uniforms:

  "error X4507: maximum ps_3_0 constant register index (224) exceeded - Try reducing number of constants referenced"

The maximum number of pixel shader constants (ie fragment uniforms) available 
in D3D9 is 224.  
ANGLE exposes GL_MAX_FRAGMENT_UNIFORM_VECTORS = 221 to the application (we need 
to use a few internally).

Looking at the shader in question, here are the uniforms:
 - uniform samplerCube source;
 - uniform vec2 viewport;   // 1 vector
 - uniform mat4 inv_proj;   // 4 vectors
 - uniform mat3 inv_view_rot; // 3 vectors
 - const int size = 256;
 - uniform vec3 rays[size]; // 256 vectors 

This adds up to about 264 uniform vectors.

Thus as indicated, too many constants (uniforms) are being used.  

Unfortunately within the D3D9 API there is no way we can increase this.  

Florian, would it be possible to scale down the number of rays being used to 
fit within the available fragment uniform space (as indicated by 
GL_MAX_FRAGMENT_UNIFORM_VECTORS)?

Original comment by dan...@transgaming.com on 23 Feb 2012 at 6:20

GoogleCodeExporter commented 9 years ago
The shader isn't well-formed.

Original comment by c...@chromium.org on 31 Jan 2014 at 8:51