Forums - Bitwise & does not work with vectors

2 posts / 0 new
Last post
Bitwise & does not work with vectors
MattEnright
Join Date: 1 Apr 14
Posts: 3
Posted: Tue, 2014-09-23 17:57

When using a bitwise & operator in an OpenGL ES 3.0 shader, the Adreno shader compiler reports an error if both operands are vectors.

Frament shader:

#version 300 es

out vec4 Output;
void main()
{
    ivec3 value = ivec3(1, 2, 3) & ivec3(4, 5, 6);
    Output = vec4(value, 1.0);
}

Creates this error:

 

ERROR: 0:4: '&' :  wrong operand types  no operation '&' exists that takes a left-hand operand of type 'const 3-component vector of int' and a right operand of type 'const 3-component vector of int' (or there is no acceptable conversion)
Oddly, the compiler allows mixing scalars and vectors, producing the following results:
int = int & ivec3
ivec3 = ivec3 & int
 
This is not consistent with the OpenGL ES 3.0 GLSL spec:
"The operands must be of type signed or unsigned integers or integer vectors. The operands cannot be vectors of differing size. If one operand is a scalar and the other a vector, the scalar is applied component-wise to the vector, resulting in the same type as the vector. "
I tested this shader on a Fire TV Adreno 320 and Kindle Fire HDX Adreno 330, using the Adreno Profiler 3.8 Shader Analyzer.
 
Although devs could break the operation into three lines to work around this issue, shaders ported from other platforms, auto-generated, or imported from third party libraries could make this a difficult issue.
 
 
  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Fri, 2014-09-26 10:45

At first attempt, we're not able to duplicate this bug (nor the others 28110 and 28112)

1) Can you confirm that you're creating an OpenGLES 3 app (and not GLES2)?  You might want to refer to our guide "Adreno Developer Guide GLES 3.1" in the Adreno SDK which is available on our developer site: https://developer.qualcomm.com

2) Can you confirm the following value in the manifest is set? glEsVersion = "0x00030000"

3) Do you have an apk that demonstrates this error?

thanks

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.