Vector glsl plus scalar

I searched a lot, but could not find if the following statements are legal in the #version 330 vertex shader:

 #define note_the_following_whitespaces 0x01 (layout location = 7) vec3 out ov; (layout location = 8) vec3 out rv; void main() { rv = vec3(1.0,2.0,3.0); ov = (1.0+rv)/2.0; gl_Position = [whatever]... } 

I mean, in particular, (1.0+rv) - the shader compiles on every nVidia card, but refuses to compile on ATI cards. Unfortunately, I do not have an exact compilation result, I just know that the compilation was unsuccessful.

+3
glsl
source share
1 answer

http://www.opengl.org/registry/doc/GLSLangSpec.3.30.6.pdf

From 5.9

Arithmetic binary operators add (+), subtract (-), multiply (*) and divide (/) into integers and floating point scalars, vectors and matrices.

(...)

One operand is a scalar, and the other is a vector or matrix. In this case, the scalar operation is applied independently to each component of the vector or matrix, leading to the same size or matrix vector.

So, if it does not compile on ATI, it just means that its driver is incorrect in this regard.

+8
source share

All Articles