この GLSL コードは、「oneSixth」と「twoThirds」からコンパイル時の定数を作成しますか?
// GLSL TESSELLATION EVALUATION SHADER
#version 410
layout (isolines, equal_spacing) in;
in vec4 tessColor[];
out vec4 pointColor;
const float oneSixth = 1. / 6.;
const float twoThirds = 2. / 3.;
void main ()
{
float s2 = gl_TessCoord.s * gl_TessCoord.s;
float s3 = s2 * gl_TessCoord.s;
float w0 = oneSixth - .5 * gl_TessCoord.s + .5 * s2 - oneSixth * s3;
float w1 = twoThirds - s2 + .5 * s3;
float w2 = oneSixth + .5 * gl_TessCoord.s + .5 * s2 - .5 * s3;
float w3 = oneSixth * s3;
gl_Position = w0 * gl_in[0].gl_Position + w1 * gl_in[1].gl_Position +
w2 * gl_in[2].gl_Position + w3 * gl_in[3].gl_Position;
pointColor = w0 * tessColor[0] + w1 * tessColor[1] +
w2 * tessColor[2] + w3 * tessColor[3];
}
私の同僚は、このコードは非効率的だと考えており、分割をハードコーディングする必要があると言っています。そうしないと、実行時に発生します。
const float oneSixth = .1666666667;
const float twoThirds = .6666666667;
私はGLSLを初めて使用しますが、これが必要であることに懐疑的です。何かご意見は?ベンダー依存ですか?