首页 > 解决方案 > OpenGL Nvidia驱动程序错误?

问题描述

好的,所以我对这个对我来说没有意义的错误感到生气。我最终创建了以下最小示例:

着色器:

vertex

#version 420
#define N 6 // 6 or more = bug
layout(location=0) in vec3 v[N];
out vec3 n[4];
void main()
{
    vec3 v0 = v[0];
    for (int i = 0; i < N - 2; i++) n[i] = normalize(cross(v[i + 1] - v0, v[i + 2] - v0));
    //n[0] = normalize(cross(v[1] - v0, v[2] - v0));//stupid driver bug can't unroll loops???
    //n[1] = normalize(cross(v[2] - v0, v[3] - v0));
    //n[2] = normalize(cross(v[3] - v0, v[4] - v0));
    //n[3] = normalize(cross(v[4] - v0, v[5] - v0));
}

fragment

void main()
{
}

我收到一个链接错误:

Internal error: assembly compile error for vertex shader at offset 586:
-- error message --
line 20, column 59:  error: offset for relative array access outside supported range
line 21, column 40:  error: offset for relative array access outside supported range
-- internal assembly text --
!!NVvp5.0
OPTION NV_internal;
OPTION NV_bindless_texture;
# cgc version 3.4.0001, build date Aug  5 2021
# command line args:
#vendor NVIDIA Corporation
#version 3.4.0.1 COP Build Date Aug  5 2021
#profile gp5vp
#program main
#var float3 v[0] : $vin.ATTR0 : ATTR0 : -1 : 1
#var float3 n[0] : $vout.ATTR0 : ATTR0 : -1 : 1
ATTRIB vertex_attrib[] = { vertex.attrib[0..5] };
OUTPUT result_attrib[] = { result.attrib[0..3] };
SHORT TEMP H0;
TEMP R0, R1, R2;
TEMP T;
MOV.S R0.w, {0, 0, 0, 0}.x;
REP.S {4, 0, 0, 0};
MOV.S R0.x, R0.w;
ADD.F32 R1.xyz, -vertex.attrib[0], vertex_attrib[R0.x + 32];
ADD.F32 R0.xyz, vertex_attrib[R0.x + 16], -vertex.attrib[0];
MUL.F32 R2.xyz, R0.zxyw, R1.yzxw;
MAD.F32 R0.xyz, R0.yzxw, R1.zxyw, -R2;
DP3.F32 R1.x, R0, R0;
RSQ.F32 R1.x, R1.x;
MUL.F32 R0.xyz, R1.x, R0;
MOV.S R1.x, R0.w;
MOV.F result_attrib[R1.x].xyz, R0;
ADD.S R0.w, R0, {1, 0, 0, 0}.x;
ENDREP;
END
# 14 instructions, 3 R-regs

如果我手动展开循环,它似乎可以工作。我从来没有遇到过这么奇怪的错误。这里发生了什么?有人可以测试 AMD 吗?

标签: openglglslnvidia

解决方案


推荐阅读