View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0029474 | Open CASCADE | OCCT:Visualization | public | 2018-02-02 14:36 | 2018-06-29 21:19 |
| Reporter | kgv | Assigned To | apn | ||
| Priority | normal | Severity | minor | ||
| Status | closed | Resolution | fixed | ||
| OS | Android | ||||
| Product Version | 7.4.0 | ||||
| Target Version | 7.3.0 | Fixed in Version | 7.3.0 | ||
| Summary | 0029474: Visualization, TKOpenGl - GLSL compilation errors on buggy OpenGL ES driver for PowerVR SGX 544MP | ||||
| Description | The following errors occur while trying to compiler GLSL shader:
15:13 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
// Enable extensions used in OCCT GLSL programs
#define OCC_ENABLE_draw_buffers
#extension GL_EXT_draw_buffers : enable
#define VERTEX_SHADER
// Created on: 2013-10-10
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//! @file Declarations.glsl
//! This files includes definition of common uniform variables in OCCT GLSL programs
//! @def THE_MAX_LIGHTS
//! Specifies the length of array of lights, which is 8 by default. Defined by Shader Manager.
// #define THE_MAX_LIGHTS 8
//! @def THE_MAX_CLIP_PLANES
//! Specifies the length of array of clipping planes, which is 8 by default. Defined by Shader Manager.
// #define THE_MAX_CLIP_PLANES 8
// compatibility macros
#if (__VERSION__ >= 130)
#define THE_ATTRIBUTE in
#define THE_SHADER_IN in
#define THE_SHADER_OUT out
#define THE_OUT out
#define occTexture1D texture
#define occTexture2D texture
#define occTexture3D texture
#else
#define THE_ATTRIBUTE attribute
#define THE_SHADER_IN varying
#define THE_SHADER_OUT varying
#define THE_OUT
#define occTexture1D texture1D
#define occTexture2D texture2D
#define occTexture3D texture3D
#endif
#ifdef GL_ES
#define THE_PREC_ENUM lowp // enumerations should fit into lowp range
#else
#define THE_PREC_ENUM
#endif
// Vertex attributes
#ifdef VERTEX_SHADER
THE_ATTRIBUTE vec4 occVertex;
THE_ATTRIBUTE vec3 occNormal;
THE_ATTRIBUTE vec4 occTexCoord;
THE_ATTRIBUTE vec4 occVertColor;
#elif defined(FRAGMENT_SHADER)
#if (__VERSION__ >= 130)
#ifdef OCC_ENABLE_draw_buffers
out vec4 occFragColorArray[2];
#define occFragColor occFragColorArray[0]
#define occFragCoverage occFragColorArray[1]
#else
out vec4 occFragColor;
#endif
#else
#ifdef OCC_ENABLE_draw_buffers
#define occFragColor gl_FragData[0]
#define occFragCoverage gl_FragData[1]
#else
#define occFragColor gl_FragColor
#endif
#endif
#endif
// Matrix state
uniform mat4 occWorldViewMatrix; //!< World-view matrix
uniform mat4 occProjectionMatrix; //!< Projection matrix
uniform mat4 occModelWorldMatrix; //!< Model-world matrix
uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix
uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix
uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix
uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix
uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix
uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix
uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix
uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix
uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix
// light type enumeration
const int OccLightType_Direct = 1; //!< directional light source
const int OccLightType_Point = 2; //!< isotropic point light source
const int OccLightType_Spot = 3; //!< spot light source
// Light sources
uniform vec4 occLightAmbient; //!< Cumulative ambient color
#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources
int occLight_Type (in int theId); //!< Type of light source
int occLight_IsHeadlight (in int theId); //!< Is light a headlight?
vec3 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source
vec3 occLight_Specular (in int theId); //!< Specular intensity (currently - equals to diffuse intensity)
vec3 occLight_Position (in int theId); //!< Position of specified light source
vec3 occLight_SpotDirection (in int theId); //!< Direction of specified spot light source
float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians)
float occLight_ConstAttenuation (in int theId); //!< Const attenuation factor of positional light source
float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source
float occLight_QuadraticAttenuation (in int theId); //!< Quadratic attenuation factor of positional light source
float occLight_Attenuation (in int theId, in float theDist); //!< attenuation coefficient of positional light source
float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)
#endif
// Front material properties accessors
vec4 occFrontMaterial_Emission(void); //!< Emission color
vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection
vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection
vec4 occFrontMaterial_Specular(void); //!< Specular reflection
float occFrontMaterial_Shininess(void); //!< Specular exponent
float occFrontMaterial_Transparency(void); //!< Transparency coefficient
// Back material properties accessors
vec4 occBackMaterial_Emission(void); //!< Emission color
vec4 occBackMaterial_Ambient(void); //!< Ambient reflection
vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection
vec4 occBackMaterial_Specular(void); //!< Specular reflection
float occBackMaterial_Shininess(void); //!< Specular exponent
float occBackMaterial_Transparency(void); //!< Transparency coefficient
#define occActiveSampler occSampler0 //!< alias for backward compatibility
#define occSamplerBaseColor occSampler0 //!< alias to a base color texture
uniform sampler2D occSampler0; //!< current active sampler;
//! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing
uniform vec4 occColor; //!< color value (in case of disabled lighting)
uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?
uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?
uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters
uniform float occPointSize; //!< point size
//! Parameters of blended order-independent transparency rendering algorithm
uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)
uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment
//! Parameters of clipping planes
#if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)
uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];
uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes
#endif
// Created on: 2013-10-10
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// This file includes implementation of common functions and properties accessors
#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
// arrays of light sources
uniform THE_PREC_ENUM ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types
uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters
// light source properties accessors
int occLight_Type (in int theId) { return occLightSourcesTypes[theId].x; }
int occLight_IsHeadlight (in int theId) { return occLightSourcesTypes[theId].y; }
vec3 occLight_Diffuse (in int theId) { return occLightSources[theId * 4 + 0].xyz; }
vec3 occLight_Specular (in int theId) { return occLightSources[theId * 4 + 0].xyz; }
vec3 occLight_Position (in int theId) { return occLightSources[theId * 4 + 1].xyz; }
vec3 occLight_SpotDirection (in int theId) { return occLightSources[theId * 4 + 2].xyz; }
float occLight_SpotCutOff (in int theId) { return occLightSources[theId * 4 + 2].w; }
float occLight_ConstAttenuation (in int theId) { return occLightSources[theId * 4 + 3].x; }
float occLight_LinearAttenuation (in int theId) { return occLightSources[theId * 4 + 3].y; }
float occLight_QuadraticAttenuation(in int theId) { return occLightSources[theId * 4 + 3].z; }
float occLight_SpotExponent (in int theId) { return occLightSources[theId * 4 + 3].w; }
float occLight_Attenuation (in int theId, in float theDist)
{
return 1.0 / (occLightSources[theId * 4 + 3].x + occLightSources[theId * 4 + 3].y * theDist + occLightSources[theId * 4 + 3].z * theDist * theDist);
}
#endif
// material state
uniform vec4 occFrontMaterial[5];
uniform vec4 occBackMaterial[5];
// front material properties accessors
vec4 occFrontMaterial_Ambient(void) { return occFrontMaterial[0]; }
vec4 occFrontMaterial_Diffuse(void) { return occFrontMaterial[1]; }
vec4 occFrontMaterial_Specular(void) { return occFrontMaterial[2]; }
vec4 occFrontMaterial_Emission(void) { return occFrontMaterial[3]; }
float occFrontMaterial_Shininess(void) { return occFrontMaterial[4].x; }
float occFrontMaterial_Transparency(void) { return occFrontMaterial[4].y; }
// back material properties accessors
vec4 occBackMaterial_Ambient(void) { return occBackMaterial[0]; }
vec4 occBackMaterial_Diffuse(void) { return occBackMaterial[1]; }
vec4 occBackMaterial_Specular(void) { return occBackMaterial[2]; }
vec4 occBackMaterial_Emission(void) { return occBackMaterial[3]; }
float occBackMaterial_Shininess(void) { return occBackMaterial[4].x; }
float occBackMaterial_Transparency(void) { return occBackMaterial[4].y; }
// 2D texture coordinates transformation
vec2 occTextureTrsf_Translation(void) { return occTexTrsf2d[0].xy; }
vec2 occTextureTrsf_Scale(void) { return occTexTrsf2d[0].zw; }
float occTextureTrsf_RotationSin(void) { return occTexTrsf2d[1].x; }
float occTextureTrsf_RotationCos(void) { return occTexTrsf2d[1].y; }
THE_SHADER_OUT vec4 VertColor;
void main()
{
VertColor = occVertColor;
gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * occVertex;
}
15:13 TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
Failed to compile shader object. Compilation log:
Compile failed.
ERROR: 0:105: Syntax error, unexpected 'THE_MAX_LIGHTS'
ERROR: 0:152: Syntax error, unexpected 'THE_MAX_CLIP_PLANES'
ERROR: 0:173: Syntax error, unexpected 'THE_MAX_LIGHTS'
ERROR: 3 compilation errors. No code generated.
on device having PowerVR SGX 544MP:
15:28 EGLVersion: 1.4 Android META-EGL
EGLVendor: Android
EGLClientAPIs: OpenGL_ES
GLvendor: Imagination Technologies
GLdevice: PowerVR SGX 544MP
GLversion: OpenGL ES 2.0 build 1.12@2824438 [GLSL: OpenGL ES GLSL ES 1.00 build 1.12@2824438]
Max texture size: 4096
Max combined texture units: 8
Max MSAA samples: 0
Viewport: 1280x727
Available CPU cores: 4
System Memory: 968 MiB
The issue happens at lines like this:
#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
in case when THE_MAX_LIGHTS is undefined. This is regression after #0029283. | ||||
| Steps To Reproduce | N/A | ||||
| Tags | No tags attached. | ||||
| Test case number | Not needed | ||||
|
|
|
Screenshot_2018-02-02-15-32-58.png (128,582 bytes) |
|
|
|
|
|
Branch CR29474 has been created by kgv. SHA-1: 86eabcc6a7b5b1e1289be73411d12463d15cceb1 Detailed log of new commits: Author: kgv Date: Fri Feb 2 16:21:47 2018 +0300 0029474: Visualization, TKOpenGl - GLSL compilation errors on buggy OpenGL ES driver for PowerVR SGX 544MP OpenGl_ShaderProgram::Initialize() now defines THE_MAX_LIGHTS/THE_MAX_CLIP_PLANES to zeros to workaround issues with some buggy OpenGL drivers. |
|
|
Please take the patch. I have started testing, but there is no need to wait until it is finished. |
|
|
Branch CR29474 has been deleted by kgv. SHA-1: 86eabcc6a7b5b1e1289be73411d12463d15cceb1 |
|
occt: master 05fb2b05 2018-02-02 13:21:47 Committer: apn Details Diff |
0029474: Visualization, TKOpenGl - GLSL compilation errors on buggy OpenGL ES driver for PowerVR SGX 544MP OpenGl_ShaderProgram::Initialize() now defines THE_MAX_LIGHTS/THE_MAX_CLIP_PLANES to zeros to workaround issues with some buggy OpenGL drivers. |
Affected Issues 0029474 |
|
| mod - src/OpenGl/OpenGl_ShaderProgram.cxx | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2018-02-02 14:36 | kgv | New Issue | |
| 2018-02-02 14:36 | kgv | Assigned To | => kgv |
| 2018-02-02 14:38 | kgv | File Added: Screenshot_2018-02-02-15-32-58.png | |
| 2018-02-02 14:38 | kgv | File Added: buckling.log | |
| 2018-02-02 16:23 | git | Note Added: 0073734 | |
| 2018-02-02 16:25 | kgv | Note Added: 0073735 | |
| 2018-02-02 16:25 | kgv | Assigned To | kgv => bugmaster |
| 2018-02-02 16:25 | kgv | Status | new => resolved |
| 2018-02-02 16:25 | kgv | Status | resolved => reviewed |
| 2018-02-02 20:33 | apn | Test case number | => Not needed |
| 2018-02-02 20:43 | kgv | Description Updated | |
| 2018-02-02 20:43 | kgv | Steps to Reproduce Updated | |
| 2018-02-02 20:44 | kgv | OS | => Android |
| 2018-02-02 20:44 | kgv | OS Version | => 4.4.2 |
| 2018-02-03 18:59 | apn | Changeset attached | => occt master 05fb2b05 |
| 2018-02-03 18:59 | apn | Assigned To | bugmaster => apn |
| 2018-02-03 18:59 | apn | Status | reviewed => verified |
| 2018-02-03 18:59 | apn | Resolution | open => fixed |
| 2018-02-05 11:39 | git | Note Added: 0073786 | |
| 2018-02-20 12:58 |
|
Target Version | 7.4.0 => 7.3.0 |
| 2018-06-29 21:15 |
|
Fixed in Version | => 7.3.0 |
| 2018-06-29 21:19 |
|
Status | verified => closed |