Bug report and files:
https://github.com/mc-imperial/shader-compiler-bugs/issues/15
Fragment shader:
#version 440
void main()
{
vec3 dir = vec3(1.0);
vec4 A[5] = vec4[5]((vec4(1.0)), (vec4(1.0)), (vec4(1.0)), (vec4(1.0)), mod(vec4(1.0), vec4(3.7, 1.0, 8.1, 2.3)));
int i = (floatBitsToInt(1.0) + clamp(ivec4(72114, 6043, 47109, 71450), ivec4(47148, 21410, 1, 79446), ivec4(1))[3]);
vec2 p = mod(vec2(1.0) * A[i].y, 2.0) - 1.0;
float r = length(p);
vec4 col = vec4(0., 0., 0., 0.);
if(r < 0.70) {
col = vec4(1.0);
}
dir = mix(vec3(1.0), col.rgb, 1.0);
for(int r = 0; 1 < 12; r ++) {
dir += vec3(1.0);
}
}
Link error log:
Fragment info
-------------
Internal error: assembly compile error for fragment shader at offset 544:
-- error message --
line 21, column 30: error: offset for relative array access outside supported range
-- internal assembly text --
!!NVfp5.0
OPTION NV_bindless_texture;
# cgc version 3.4.0001, build date Oct 1 2016
# command line args:
#vendor NVIDIA Corporation
#version 3.4.0.1 COP Build Date Oct 1 2016
#profile gp5fp
#program main
#semantic @TMP34 : __LOCAL
#var float4 @TMP34[0] : : local[0] : -1 : 1
TEMP R0;
TEMP RC, HC;
TEMP lmem[5];
MOV.F lmem[0], {1, 0, 0, 0}.x;
MOV.F lmem[1], {1, 0, 0, 0}.x;
MOV.F lmem[2], {1, 0, 0, 0}.x;
MOV.F lmem[3], {1, 0, 0, 0}.x;
MOV.F R0.x, {1, 0, 0, 0};
MOV.U R0.x, R0;
MOV.F lmem[4], {1, 0, 0, 0}.xyxx;
MOV.F R0.y, lmem[R0.x + 79446].y;
MUL.F R0.x, R0.y, {0.5, 0, 0, 0};
FLR.F R0.x, R0;
MAD.F R0.x, -R0, {2, 0, 0, 0}, R0.y;
ADD.F R0.x, R0, {-1, 0, 0, 0};
DP2.F R0.x, R0.x, R0.x;
RSQ.F R0.x, R0.x;
RCP.F R0.x, R0.x;
SLT.F R0.x, R0, {0.699999988, 0, 0, 0};
TRUNC.U.CC HC.x, R0;
IF NE.x;
ENDIF;
REP.S ;
SEQ.U.CC HC.x, {1, 0, 0, 0}, {0, 0, 0, 0};
BRK (NE.x);
ENDREP;
END
# 23 instructions, 1 R-regs
Note that the shader is accepted by glslangValidator and by a recent Intel driver.
- Operating system version.
Windows 10
- Graphics hardware.
GeForce GTX 770. Driver: 373.06
-
Reproducer project.
We have provided the fragment shader at the above link. -
Description of single steps to reproduce the problem.
Compile and link the fragment shader. -
Description of the expected result.
No link error.