microsoft / angle

ANGLE: OpenGL ES to DirectX translation
Other
615 stars 166 forks source link

if EGLAutomaticStereoRenderingProperty=true , then glCompileShader failed #121

Open vd3d opened 7 years ago

vd3d commented 7 years ago

Hi,

I have an existing application and a shader, everything works fine until I set : EGLAutomaticStereoRenderingProperty = true

I got the following error message (looks like an unexpectederror):

Info log: ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍýýýýÝ

Here is my shader code:

`

version 100

// We use highp to avoid problems with mobile devices

// highp is always available in vertex shaders precision highp float; precision highp int;

// automatic uniforms uniform vec3 render_camera_pos_low; uniform vec3 render_camera_pos_high; uniform mat4 render_mvp_rel_camera; uniform mat4 render_mv_rel_camera; uniform mat4 render_mvp; uniform mat4 render_mv; uniform mat4 render_projection; uniform vec3 render_forward; uniform vec4 render_viewport; uniform vec2 render_pixelscale;

// Returns the position, relative to the camera (e.g. world space, but relative to the camera) vec3 getRelativePosition(vec3 posLow, vec3 posHigh) { vec3 lowDifference = posLow - render_camera_pos_low; vec3 highDifference = posHigh - render_camera_pos_high; return lowDifference + highDifference; }

// Returns the position, relative to the camera (e.g. world space, but relative to the camera) vec3 getRelativePosition(vec3 posLow, vec3 posHigh, vec3 cameraPosLow, vec3 cameraPosHigh) { vec3 lowDifference = posLow - cameraPosLow; vec3 highDifference = posHigh - cameraPosHigh; return lowDifference + highDifference; }

// Transforms from world to camera coordinates vec3 relPositionToCamera(vec3 relPos) { return (render_mv_rel_camera * vec4(relPos, 1.0)).xyz; }

// Projects a relative position (relative to the camera). The result is a homogenous view position (e.g. in clip space). vec4 projectRelPosition(vec3 relPos) { return render_mvp_rel_camera * vec4(relPos, 1.0); }

// Projects from camera coordinates (e.g. camera space). The result is a homogenous view position (e.g. in clip space). vec4 projectCameraPosition(vec3 relPos) { return render_projection * vec4(relPos, 1.0); }

// Projects a position, encoded as a double-float. The result is a homogenous view position (e.g. in clip space). vec4 projectPosition(vec3 posLow, vec3 posHigh) { return render_mvp_rel_camera * vec4(getRelativePosition(posLow, posHigh), 1.0); }

// Projects a position, with custom parameters. Used mainly for draping. vec4 projectPosition(vec3 posLow, vec3 posHigh, mat4 transformation, vec3 cameraPosLow, vec3 cameraPosHigh) { vec3 lowDifference = posLow - cameraPosLow; vec3 highDifference = posHigh - cameraPosHigh; return transformation * vec4(lowDifference + highDifference, 1.0); }

// Projects an absolute position, encoded as a float. The result is a homogenous view position (e.g. in clip space). vec4 projectPosition(vec3 pos) { return render_mvp * vec4(pos, 1.0); }

vec4 projectDirectionVector(vec3 vector) { return render_mvp * vec4(vector, 0.0); }

vec2 ndcToPixel(vec2 ndcPt) { return (ndcPt + 1.0) * render_pixelscale; }

vec2 pixelToNdc(vec2 pixelPt) { return pixelPt / render_pixelscale - 1.0; }

// Indicates if a position is invalid (see GeometryPool invalid vertex) bool isPositionInvalid(vec3 posLow, vec3 posHigh) { /**

// Position as defined relative to uLocalOrigin attribute vec3 aPosition; // Texture uv coordinates attribute vec2 aUV; // Geocentric normal attribute vec3 aGeocentricNormal; // World normal attribute vec3 aNormal; // Elevation above ellipsoid attribute float aElevation;

// The local origin uniform vec3 uLocalOrigin;

// Terrain texture coordinates varying vec2 vTextureUVTerrain; // The point of the vertex on the ellipsoid, in world reference varying vec4 vZeroElevationWorldPoint; // Normal on the terrain in world coordinates varying vec3 vNormal; // Normal on the ellipsoid varying vec3 vGeocentricNormal;

void main() { vTextureUVTerrain = aUV; vZeroElevationWorldPoint = vec4(aPosition.xyz - aElevation * aGeocentricNormal, 0.0); vNormal = aNormal; vGeocentricNormal = aGeocentricNormal;

gl_Position = projectPosition(aPosition, uLocalOrigin); } `

austinkinross commented 7 years ago

@MikeRiches, do you know what might be causing this?

MikeRiches commented 7 years ago

Try converting the shader to #version 300.

MikeRiches commented 7 years ago

You may also need to make sure that your EGL_CONTEXT_CLIENT_VERSION is set to 3.

vd3d commented 7 years ago

Thanks,

EGL_CONTEXT_CLIENT_VERSION is set to 3

The shader version is set to 100, but I have see some code inside ANGLE that "try" convert the shader to version 300. Not sure it really work and it is really related !

I have see some cases that are not well handled, by example:

I have to debug more to see what is missing, can you help please ?