【发布时间】:2011-12-16 23:42:00
【问题描述】:
我有一个用于进行光线追踪的 WebGL 片段着色器。我使用纹理传入球体和三角形数据。到目前为止,我已经有 2 个球体和 3 个三角形在工作。当我添加调用以检查与第 4 个三角形的交点时,着色器不会链接,并且调用 getProgramInfoLog() 只会返回 null。
片段着色器会变得太大吗?还是我需要寻找其他原因?如何确定问题可能出在哪里?
这是一个代码 sn-p,注释掉任何一个 checkTriangleIntersection 调用都会导致着色器成功链接。
checkTriangleIntersection(0.0, rayOrigin, rayDir, piOfNearest, normalOfNearest, colourOfNearest, distOfNearest);
checkTriangleIntersection(1.0, rayOrigin, rayDir, piOfNearest, normalOfNearest, colourOfNearest, distOfNearest);
checkTriangleIntersection(2.0, rayOrigin, rayDir, piOfNearest, normalOfNearest, colourOfNearest, distOfNearest);
//checkTriangleIntersection(3.0, rayOrigin, rayDir, piOfNearest, normalOfNearest, colourOfNearest, distOfNearest);
由于所有调用都是相同的,除了索引之外,我认为代码本身不会有任何问题,但是我可能会遇到某种限制吗?
在我添加额外的函数调用之前,我获得了超过 30 FPS,即使我添加了额外的调用,顶点着色器和片段着色器都可以编译。
【问题讨论】:
标签: linker linker-errors webgl raytracing fragment-shader