Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment shader error #34

Open
ghost opened this issue Jul 13, 2019 · 11 comments
Open

Fragment shader error #34

ghost opened this issue Jul 13, 2019 · 11 comments

Comments

@ghost
Copy link

ghost commented Jul 13, 2019

Hi,

I can't load my 3D volume on my laptop without getting the shader failed error below:

`-------------Error----------------

Fragment shader failed to compile with the following errors:
ERROR: 0:85: error(#132) Syntax error: ")" parse error
ERROR: error(#273) 1 compilation errors. No code generated

-----------Shader---------------

1 : #extension GL_ARB_texture_rectangle : enable
2 : uniform sampler2D lutTex;
3 : uniform sampler2DRect dragTex;
4 : uniform int gridx;
5 : uniform int gridy;
6 : uniform int gridz;
7 : uniform int ncols;
8 : uniform int llod;
9 : uniform int lgridx;
10 : uniform int lgridy;
11 : uniform int lgridz;
12 : uniform int lncols;
13 : uniform bool opshader;
14 : uniform float tfSet;
15 : void main(void)
16 : {
17 : vec2 tc = gl_TexCoord[0].xy;
18 : int lcol = int(tc.x)/lgridx;
19 : int lrow = int(tc.y)/lgridy;
20 : float x = tc.x - float(lcollgridx);
21 : float y = tc.y - float(lrow
lgridy);
22 : float z = float(lrowlncols + lcol);
23 : vec3 pos = vec3(x,y,z);
24 : bvec3 pless = lessThan(pos, vec3(1.5,1.5,1.5));
25 : bvec3 pgret = greaterThan(pos, vec3(float(lgridx)-2.5,float(lgridy)-2.5,float(lgridz)-2.5));
26 : if (any(pless) || any(pgret))
27 : { gl_FragColor = vec4(0.0,0.0,0.0,0.0); return; }
28 : float xO = x
float(llod);
29 : float yO = yfloat(llod);
30 : float zO = z
float(llod);
31 : int alod = llod-1;
32 : vec4 fcolor = vec4(0.0,0.0,0.0,0.0);
33 : for(int xa=-alod; xa<=alod; xa++)
34 : for(int ya=-alod; ya<=alod; ya++)
35 : for(int za=-alod; za<=alod; za++)
36 : {
37 : float x = xO + xa;
38 : float y = yO + ya;
39 : float z = zO + za;
40 : int row = int(z)/ncols;
41 : int col = int(z) - row*ncols;
42 : row *= gridy;
43 : col = gridx;
44 : tc = vec2(float(col)+x, float(row)+y);
45 : vec2 vg;
46 : vg.x = texture2DRect(dragTex, tc.xy).x;
47 : vec3 sample1, sample2;
48 : float x1 = max(0.0, float(x-1.0));
49 : sample1.x = texture2DRect(dragTex, vec2(float(col)+x1, float(row)+y)).x;
50 : x1 = min(float(gridx-1), float(x+1.0));
51 : sample2.x = texture2DRect(dragTex, vec2(float(col)+x1, float(row)+y)).x;
52 : float y1 = max(0.0, float(y-1.0));
53 : sample1.y = texture2DRect(dragTex, vec2(float(col)+x, float(row)+y1)).x;
54 : y1 = min(float(gridy-1), float(y+1.0));
55 : sample2.y = texture2DRect(dragTex, vec2(float(col)+x, float(row)+y1)).x;
56 : int z1 = int(max(0.0, float(z-1.0)));
57 : row = z1/ncols;
58 : col = z1 - row
ncols;
59 : row *= gridy;
60 : col = gridx;
61 : sample1.z = texture2DRect(dragTex, vec2(float(col)+x, float(row)+y)).x;
62 : z1 = int(min(float(gridz-1), float(z+1.0)));
63 : row = z1/ncols;
64 : col = z1 - row
ncols;
65 : row *= gridy;
66 : col = gridx;
67 : sample2.z = texture2DRect(dragTex, vec2(float(col)+x, float(row)+y)).x;
68 : vg.y = distance(sample1, sample2);
69 : float val = vg.x;
70 : float grad = vg.y
0.125;
71 : vg.y = tfSet + grad;
72 : if (opshader)
73 : {
74 : float alpha = texture2D(lutTex, vg.xy).a;
75 : fcolor += vec4(val, grad, alpha, 1.0);
76 : }
77 : else
78 : {
79 : vec4 clr = texture2D(lutTex, vg.xy);
80 : clr.rgb = clr.a;
81 : clr.a = step(0.01, clr.a);
82 : fcolor += clr;
83 : }
84 : }
85 : gl_FragColor = fcolor/pow(2.0
(float)alod+1, 3.0);
86 : }
87 : `

I have been able to open the same volume on another PC. I'm running drishti 2.6.5 on a windows 10 laptop with integrated amd radeon r6 graphics card. I've updated the driver but I still get the same error.

Thanks,
Nathan

@AjayLimaye
Copy link
Collaborator

AjayLimaye commented Jul 14, 2019 via email

@Wencke1
Copy link

Wencke1 commented Oct 3, 2019

Hi erveryone.
I do have the same problem with the same error code.
I updated the driver but still the same problem. I am running drishti 2.6.5 on a windows 10 PC with a Radeon Pro WX7100 graphics card.
Cheers
Wencke

@Wencke1
Copy link

Wencke1 commented Oct 7, 2019

Hi everyone,
I found a solution which workes for me.
I use drishdi 2.6.4 now, and this works with my setting without a problem.
Cheers
Wencke

@AjayLimaye
Copy link
Collaborator

AjayLimaye commented Oct 7, 2019 via email

@Wencke1
Copy link

Wencke1 commented Oct 8, 2019 via email

@pavel-perina
Copy link

Hi.
Very similar error, I may try to update driver. This one came as with Windows 10 1903.

Radeon RX 570 Series AMD Radeon Graphics Processor (0x67DF)
driver version: 22.19.162.4
driver date: 2017-04-24

OpenGL info:
ATI Technologies Inc.
Radeon RX 570 Series
3.2.13474 Core Profile Forward-Compatible Context 22.19.162.4
-------------Error----------------

Fragment shader failed to compile with the following errors:
ERROR: 0:69: error(#132) Syntax error: ")" parse error
ERROR: error(#273) 1 compilation errors. No code generated

-----------Shader---------------

1 : #extension GL_ARB_texture_rectangle : enable
2 : uniform sampler2D lutTex;
3 : uniform sampler2DRect dragTex;
4 : uniform int gridx;
5 : uniform int gridy;
6 : uniform int gridz;
7 : uniform int ncols;
8 : uniform int llod;
9 : uniform int lgridx;
10 : uniform int lgridy;
11 : uniform int lgridz;
12 : uniform int lncols;
13 : uniform bool opshader;
14 : uniform float tfSet;
15 : void main(void)
16 : {
17 : vec2 tc = gl_TexCoord[0].xy;
18 : int lcol = int(tc.x)/lgridx;
19 : int lrow = int(tc.y)/lgridy;
20 : float x = tc.x - float(lcollgridx);
21 : float y = tc.y - float(lrow
lgridy);
22 : float z = float(lrowlncols + lcol);
23 : vec3 pos = vec3(x,y,z);
24 : bvec3 pless = lessThan(pos, vec3(1.5,1.5,1.5));
25 : bvec3 pgret = greaterThan(pos, vec3(float(lgridx)-2.5,float(lgridy)-2.5,float(lgridz)-2.5));
26 : if (any(pless) || any(pgret))
27 : { gl_FragColor = vec4(0.0,0.0,0.0,0.0); return; }
28 : float xO = x
float(llod);
29 : float yO = yfloat(llod);
30 : float zO = z
float(llod);
31 : int alod = llod-1;
32 : vec4 fcolor = vec4(0.0,0.0,0.0,0.0);
33 : for(int xa=-alod; xa<=alod; xa++)
34 : for(int ya=-alod; ya<=alod; ya++)
35 : for(int za=-alod; za<=alod; za++)
36 : {
37 : float x = xO + xa;
38 : float y = yO + ya;
39 : float z = zO + za;
40 : int row = int(z)/ncols;
41 : int col = int(z) - row*ncols;
42 : row = gridy;
43 : col = gridx;
44 : tc = vec2(float(col)+x, float(row)+y);
45 : vec2 vg;
46 : vg.x = texture2DRect(dragTex, tc.xy).x;
47 : int h0 = int(65535.0
vg.x);
48 : int h1 = h0 / 256;
49 : h0 = int(mod(float(h0),256.0));
50 : float fh0 = float(h0)/256.0;
51 : float fh1 = float(h1)/256.0;
52 : vg.xy = vec2(fh0, fh1);
53 : float val = vg.x;
54 : float grad = vg.y
0.125;
55 : vg.y = tfSet + grad;
56 : if (opshader)
57 : {
58 : float alpha = texture2D(lutTex, vg.xy).a;
59 : fcolor += vec4(val, grad, alpha, 1.0);
60 : }
61 : else
62 : {
63 : vec4 clr = texture2D(lutTex, vg.xy);
64 : clr.rgb = clr.a;
65 : clr.a = step(0.01, clr.a);
66 : fcolor += clr;
67 : }
68 : }
69 : gl_FragColor = fcolor/pow(2.0
(float)alod+1, 3.0);
70 : }
71 :

@pavel-perina
Copy link

Actually, I guess bug is in (float)alod which should be float(alod) ... and i forgot if shaders allow implicit conversions, maybe there should be 1.0 instead of 1

@pavel-perina
Copy link

I patched executable to fix the previous error and got another one.
Obviously it was never tested on AMD GPUs.

-------------Error----------------

Fragment shader failed to compile with the following errors:
ERROR: 0:22: error(#160) Cannot convert from: "float" to: "highp int"
ERROR: error(#273) 1 compilation errors. No code generated

-----------Shader---------------

1 : #extension GL_ARB_texture_rectangle : enable
2 : uniform sampler2DRect lightTex;
3 : uniform int gridx;
4 : uniform int gridy;
5 : uniform int gridz;
6 : uniform int ncols;
7 : uniform float llod;
8 : uniform int lgridx;
9 : uniform int lgridy;
10 : uniform int lncols;
11 : void main(void)
12 : {
13 : vec2 tc = gl_TexCoord[0].xy;
14 : int col = int(tc.x)/gridx;
15 : int row = int(tc.y)/gridy;
16 : float x = tc.x - float(colgridx);
17 : float y = tc.y - float(row
gridy);
18 : float z = float(rowncols + col);
19 : float xO = x
float(llod);
20 : float yO = yfloat(llod);
21 : float zO = z
float(llod);
22 : int alod = llod-1;
23 : vec4 fcolor = vec4(0.0,0.0,0.0,0.0);
24 : for(int xa=-alod; xa<=alod; xa++)
25 : for(int ya=-alod; ya<=alod; ya++)
26 : for(int za=-alod; za<=alod; za++)
27 : {
28 : float x = xO + xa;
29 : float y = yO + ya;
30 : float z = zO + za;
31 : int lrow = int(z)/lncols;
32 : int lcol = int(z) - lrow*lncols;
33 : lrow *= lgridy;
34 : lcol = lgridx;
35 : vec2 ltc = vec2(float(lcol)+x, float(lrow)+y);
36 : fcolor += vec4(texture2DRect(lightTex, ltc).rgb, 1.0);
37 : }
38 : gl_FragColor = fcolor/pow(2.0
float(alod)+1, 3.0);
39 : }
40 :

@AjayLimaye
Copy link
Collaborator

AjayLimaye commented Oct 14, 2019 via email

@pavel-perina
Copy link

pavel-perina commented Oct 14, 2019 via email

@AjayLimaye
Copy link
Collaborator

AjayLimaye commented Oct 14, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants