View Issue Details

IDProjectCategoryView StatusLast Update
0030705CommunityOCCT:Visualizationpublic2019-05-19 10:53
ReporterVico Liang Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformMacOSOS 
Product Version7.0.0 
Target Version7.4.0Fixed in Version7.4.0 
Summary0030705: Visualization, TKOpenGl - stipple line GLSL error on using OpenGL 2.1 + GL_EXT_gpu_shader4 extension on macOS
Description236: uniform int uPattern;
237: uniform float uFactor;
238: THE_SHADER_IN vec2 ScreenSpaceCoord;
239: vec4 getColor(void) { return occColor; }
240: #define getFinalColor getColor
241: void main()
242: {
243: float anAngle = atan (dFdx (ScreenSpaceCoord.x), dFdy (ScreenSpaceCoord.y));
244: float aRotatePoint = gl_FragCoord.x * sin (anAngle) + gl_FragCoord.y * cos (anAngle);
245: uint aBit = uint (floor (aRotatePoint / uFactor + 0.5)) & 15U;
246: if ((uint (uPattern) & (1U << aBit)) == 0U) discard;
247: vec4 aColor = getFinalColor();
248: if (aColor.a <= 0.1) discard;
249: occSetFragColor (aColor);
250: }
TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
  Failed to compile Fragment Shader [occt_unlit0020]. Compilation log:
ERROR: 0:245: 'aBit' : syntax error: syntax error
Steps To Reproduce
pload MODELING VISUALIZATION
vclear
# no issues within Core Profile on macOS
#vcaps -core
#vgldebug -debug 1 -glslWarn 1 -glslCode short
vinit View1
box b 1 2 3
vdisplay -dispMode 0 b
vfit
vglinfo
vaspects b -lineType DASH


OpenGL info:
  GLvendor: ATI Technologies Inc.
  GLdevice: AMD Radeon Pro 570 OpenGL Engine
  GLversion: 2.1 ATI-2.8.38
  GLSLversion: 1.20
  Max texture size: 16384
  Max FBO dump size: 16384x16384
  Max combined texture units: 16
  Max MSAA samples: 0
  Viewport: 409x409
  GPU memory: 4096 MiB
  GPU Texture memory: 3880 MiB
  ResolutionRatio: 1
Draw[10]> vaspects b -lineType DASH
TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
  
1: #extension GL_EXT_gpu_shader4 : enable
2: // Enable extensions used in OCCT GLSL programs
3: #define FRAGMENT_SHADER
4: #define THE_MAX_LIGHTS 0
5: #define THE_MAX_CLIP_PLANES 0
6: #define THE_NB_FRAG_OUTPUTS 1
7: 
8: //! @file Declarations.glsl includes definition of common uniform variables in OCCT GLSL programs
9: //! @def THE_MAX_LIGHTS
10: //! Specifies the length of array of lights, which is 8 by default. Defined by Shader Manager.
11: // #define THE_MAX_LIGHTS 8
12: 
13: //! @def THE_MAX_CLIP_PLANES
14: //! Specifies the length of array of clipping planes, which is 8 by default. Defined by Shader Manager.
15: // #define THE_MAX_CLIP_PLANES 8
16: 
17: //! @def THE_NB_FRAG_OUTPUTS
18: //! Specifies the length of array of Fragment Shader outputs, which is 1 by default. Defined by Shader Manager.
19: // #define THE_NB_FRAG_OUTPUTS 1
20: 
21: // compatibility macros
22: #if (__VERSION__ >= 130)
23:   #define THE_ATTRIBUTE  in
24:   #define THE_SHADER_IN  in
25:   #define THE_SHADER_OUT out
26:   #define THE_OUT        out
27:   #define occTexture1D   texture
28:   #define occTexture2D   texture
29:   #define occTexture3D   texture
30: #else
31:   #define THE_ATTRIBUTE  attribute
32:   #define THE_SHADER_IN  varying
33:   #define THE_SHADER_OUT varying
34:   #define THE_OUT
35:   #define occTexture1D   texture1D
36:   #define occTexture2D   texture2D
37:   #define occTexture3D   texture3D
38: #endif
39: 
40: #ifdef GL_ES
41:   #define THE_PREC_ENUM lowp // enumerations should fit into lowp range
42: #else
43:   #define THE_PREC_ENUM
44: #endif
45: 
46: // Vertex attributes
47: #ifdef VERTEX_SHADER
48:   THE_ATTRIBUTE vec4 occVertex;
49:   THE_ATTRIBUTE vec3 occNormal;
50:   THE_ATTRIBUTE vec4 occTexCoord;
51:   THE_ATTRIBUTE vec4 occVertColor;
52: #elif defined(FRAGMENT_SHADER)
53:   #if (__VERSION__ >= 130)
54:     #ifdef OCC_ENABLE_draw_buffers
55:       out vec4 occFragColorArray[THE_NB_FRAG_OUTPUTS];
56:       #define occFragColorArrayAlias occFragColorArray
57:       #define occFragColor0 occFragColorArray[0]
58:     #else
59:       out vec4 occFragColor0;
60:     #endif
61:   #else
62:     #ifdef OCC_ENABLE_draw_buffers
63:       #define occFragColorArrayAlias gl_FragData
64:       #define occFragColor0 gl_FragData[0]
65:     #else
66:       #define occFragColor0 gl_FragColor
67:     #endif
68:   #endif
69: 
70:   #if (THE_NB_FRAG_OUTPUTS >= 2)
71:     #define occFragColor1 occFragColorArrayAlias[1]
72:   #else
73:     vec4 occFragColor1;
74:   #endif
75:   #if (THE_NB_FRAG_OUTPUTS >= 3)
76:     #define occFragColor2 occFragColorArrayAlias[2]
77:   #else
78:     vec4 occFragColor2;
79:   #endif
80:   #if (THE_NB_FRAG_OUTPUTS >= 4)
81:     #define occFragColor3 occFragColorArrayAlias[3]
82:   #else
83:     vec4 occFragColor3;
84:   #endif
85: 
86:   // Built-in outputs notation
87:   #define occFragColor    occFragColor0
88:   #define occFragCoverage occFragColor1
89: 
90:   //! Define the main Fragment Shader output - color value.
91:   void occSetFragColor (in vec4 theColor);
92: #endif
93: 
94: // Matrix state
95: uniform mat4 occWorldViewMatrix;  //!< World-view  matrix
96: uniform mat4 occProjectionMatrix; //!< Projection  matrix
97: uniform mat4 occModelWorldMatrix; //!< Model-world matrix
98: 
99: uniform mat4 occWorldViewMatrixInverse;    //!< Inverse of the world-view  matrix
100: uniform mat4 occProjectionMatrixInverse;   //!< Inverse of the projection  matrix
101: uniform mat4 occModelWorldMatrixInverse;   //!< Inverse of the model-world matrix
102: 
103: uniform mat4 occWorldViewMatrixTranspose;  //!< Transpose of the world-view  matrix
104: uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection  matrix
105: uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix
106: 
107: uniform mat4 occWorldViewMatrixInverseTranspose;  //!< Transpose of the inverse of the world-view  matrix
108: uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection  matrix
109: uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix
110: 
111: // light type enumeration
112: const int OccLightType_Direct = 1; //!< directional     light source
113: const int OccLightType_Point  = 2; //!< isotropic point light source
114: const int OccLightType_Spot   = 3; //!< spot            light source
115: 
116: // Light sources
117: uniform               vec4 occLightAmbient;      //!< Cumulative ambient color
118: #if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
119: uniform THE_PREC_ENUM int  occLightSourcesCount; //!< Total number of light sources
120: int   occLight_Type              (in int theId); //!< Type of light source
121: int   occLight_IsHeadlight       (in int theId); //!< Is light a headlight?
122: vec4  occLight_Diffuse           (in int theId); //!< Diffuse intensity for specified light source
123: vec4  occLight_Specular          (in int theId); //!< Specular intensity (currently - equals to diffuse intencity)
124: vec4  occLight_Position          (in int theId); //!< Position of specified light source
125: vec4  occLight_SpotDirection     (in int theId); //!< Direction of specified spot light source
126: float occLight_ConstAttenuation  (in int theId); //!< Const attenuation factor of positional light source
127: float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source
128: float occLight_SpotCutOff        (in int theId); //!< Maximum spread angle of the spot light (in radians)
129: float occLight_SpotExponent      (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)
130: #endif
131: 
132: // Front material properties accessors
133: vec4  occFrontMaterial_Emission(void);     //!< Emission color
134: vec4  occFrontMaterial_Ambient(void);      //!< Ambient  reflection
135: vec4  occFrontMaterial_Diffuse(void);      //!< Diffuse  reflection
136: vec4  occFrontMaterial_Specular(void);     //!< Specular reflection
137: float occFrontMaterial_Shininess(void);    //!< Specular exponent
138: float occFrontMaterial_Transparency(void); //!< Transparency coefficient
139: 
140: // Back material properties accessors
141: vec4  occBackMaterial_Emission(void);      //!< Emission color
142: vec4  occBackMaterial_Ambient(void);       //!< Ambient  reflection
143: vec4  occBackMaterial_Diffuse(void);       //!< Diffuse  reflection
144: vec4  occBackMaterial_Specular(void);      //!< Specular reflection
145: float occBackMaterial_Shininess(void);     //!< Specular exponent
146: float occBackMaterial_Transparency(void);  //!< Transparency coefficient
147: 
148: #ifdef THE_HAS_DEFAULT_SAMPLER
149: #define occActiveSampler    occSampler0                //!< alias for backward compatibility
150: #define occSamplerBaseColor occSampler0                //!< alias to a base color texture
151: uniform               sampler2D occSampler0;           //!< current active sampler;
152: #endif
153:                                                        //!  occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing
154: uniform               vec4      occColor;              //!< color value (in case of disabled lighting)
155: uniform THE_PREC_ENUM int       occDistinguishingMode; //!< Are front and back faces distinguished?
156: uniform THE_PREC_ENUM int       occTextureEnable;      //!< Is texture enabled?
157: uniform               vec4      occTexTrsf2d[2];       //!< 2D texture transformation parameters
158: uniform               float     occPointSize;          //!< point size
159: 
160: //! Parameters of blended order-independent transparency rendering algorithm
161: uniform               int       occOitOutput;      //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)
162: uniform               float     occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment
163: uniform               float     occAlphaCutoff;    //!< alpha test cutoff value
164: 
165: //! Parameters of clipping planes
166: #if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)
167: uniform               vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];
168: uniform THE_PREC_ENUM int  occClipPlaneChains[THE_MAX_CLIP_PLANES]; //! Indicating the number of planes in the Chain
169: uniform THE_PREC_ENUM int  occClipPlaneCount;   //!< Total number of clip planes
170: #endif
171: //! @endfile Declarations.glsl
172: 
173: //! @file DeclarationsImpl.glsl includes implementation of common functions and properties accessors
174: #if defined(FRAGMENT_SHADER)
175: //! Output color (and coverage for accumulation by OIT algorithm).
176: void occSetFragColor (in vec4 theColor)
177: {
178: #if defined(OCC_ALPHA_TEST)
179:   if (theColor.a < occAlphaCutoff) discard;
180: #endif
181: #if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)
182:   float aWeight     = theColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthFactor, 3.0), 1e-2, 1e+2);
183:   occFragCoverage.r = theColor.a * aWeight;
184:   occFragColor      = vec4 (theColor.rgb * theColor.a * aWeight, theColor.a);
185: #else
186:   occFragColor = theColor;
187: #endif
188: }
189: #endif
190: 
191: #if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
192: // arrays of light sources
193: uniform THE_PREC_ENUM ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types
194: uniform               vec4  occLightSources[THE_MAX_LIGHTS * 4];  //!< packed light sources parameters
195: 
196: // light source properties accessors
197: int   occLight_Type              (in int theId) { return occLightSourcesTypes[theId].x; }
198: int   occLight_IsHeadlight       (in int theId) { return occLightSourcesTypes[theId].y; }
199: vec4  occLight_Diffuse           (in int theId) { return occLightSources[theId * 4 + 0]; }
200: vec4  occLight_Specular          (in int theId) { return occLightSources[theId * 4 + 0]; }
201: vec4  occLight_Position          (in int theId) { return occLightSources[theId * 4 + 1]; }
202: vec4  occLight_SpotDirection     (in int theId) { return occLightSources[theId * 4 + 2]; }
203: float occLight_ConstAttenuation  (in int theId) { return occLightSources[theId * 4 + 3].x; }
204: float occLight_LinearAttenuation (in int theId) { return occLightSources[theId * 4 + 3].y; }
205: float occLight_SpotCutOff        (in int theId) { return occLightSources[theId * 4 + 3].z; }
206: float occLight_SpotExponent      (in int theId) { return occLightSources[theId * 4 + 3].w; }
207: #endif
208: 
209: // material state
210: uniform vec4 occFrontMaterial[5];
211: uniform vec4 occBackMaterial[5];
212: 
213: // front material properties accessors
214: vec4  occFrontMaterial_Ambient(void)      { return occFrontMaterial[0]; }
215: vec4  occFrontMaterial_Diffuse(void)      { return occFrontMaterial[1]; }
216: vec4  occFrontMaterial_Specular(void)     { return occFrontMaterial[2]; }
217: vec4  occFrontMaterial_Emission(void)     { return occFrontMaterial[3]; }
218: float occFrontMaterial_Shininess(void)    { return occFrontMaterial[4].x; }
219: float occFrontMaterial_Transparency(void) { return occFrontMaterial[4].y; }
220: 
221: // back material properties accessors
222: vec4  occBackMaterial_Ambient(void)       { return occBackMaterial[0]; }
223: vec4  occBackMaterial_Diffuse(void)       { return occBackMaterial[1]; }
224: vec4  occBackMaterial_Specular(void)      { return occBackMaterial[2]; }
225: vec4  occBackMaterial_Emission(void)      { return occBackMaterial[3]; }
226: float occBackMaterial_Shininess(void)     { return occBackMaterial[4].x; }
227: float occBackMaterial_Transparency(void)  { return occBackMaterial[4].y; }
228: 
229: // 2D texture coordinates transformation
230: vec2  occTextureTrsf_Translation(void) { return occTexTrsf2d[0].xy; }
231: vec2  occTextureTrsf_Scale(void)       { return occTexTrsf2d[0].zw; }
232: float occTextureTrsf_RotationSin(void) { return occTexTrsf2d[1].x; }
233: float occTextureTrsf_RotationCos(void) { return occTexTrsf2d[1].y; }
234: //! @endfile DeclarationsImpl.glsl
235: 
236: uniform int   uPattern;
237: uniform float uFactor;
238: THE_SHADER_IN vec2 ScreenSpaceCoord;
239: vec4 getColor(void) { return occColor; }
240: #define getFinalColor getColor
241: void main()
242: {
243:   float anAngle      = atan (dFdx (ScreenSpaceCoord.x), dFdy (ScreenSpaceCoord.y));
244:   float aRotatePoint = gl_FragCoord.x * sin (anAngle) + gl_FragCoord.y * cos (anAngle);
245:   uint  aBit         = uint (floor (aRotatePoint / uFactor + 0.5)) & 15U;
246:   if ((uint (uPattern) & (1U << aBit)) == 0U) discard;
247:   vec4 aColor = getFinalColor();
248:   if (aColor.a <= 0.1) discard;
249:   occSetFragColor (aColor);
250: }
TKOpenGl | Type: Error | ID: 0 | Severity: High | Message:
  Failed to compile Fragment Shader [occt_unlit0020]. Compilation log:
ERROR: 0:245: 'aBit' : syntax error: syntax error
TagsNo tags attached.
Test case numberNot required

Relationships

child of 0025305 closedbugmaster Open CASCADE Visualization, TKOpenGl - support stipple line aspects within built-in GLSL programs 

Activities

kgv

2019-05-10 19:41

developer   ~0084288

Please provide uncut log and device information (V3d_View::DiagnosticInformation(Graphic3d_DiagnosticInfo_Complete)).

git

2019-05-13 11:39

administrator   ~0084297

Branch CR30705 has been created by kgv.

SHA-1: dd45524b5b7a7074ea3cd5fb858d334350f8fbd3


Detailed log of new commits:

Author: kgv
Date: Mon May 13 11:31:42 2019 +0300

    0030705: Visualization, TKOpenGl - stipple line GLSL error on using OpenGL 2.1 + GL_EXT_gpu_shader4 extension on macOS
    
    Fix compatibility with pure GL_EXT_gpu_shader4 specs by defining "uint" as "unsigned int".

kgv

2019-05-13 14:17

developer   ~0084299

Patch is ready for review.

osa

2019-05-14 11:49

developer   ~0084330

Patch has been reviewed without remarks

bugmaster

2019-05-15 12:00

administrator   ~0084361

Fix has been tested in framework of WEEK-20 branch

Combination -
OCCT branch : WEEK-20
master SHA - 853af31fb14e2140d821c7ba1c5c5977072d7662
d67d4b811012eef8913d3c535c29654d0acf3c4c
Products branch : WEEK-20 SHA - bde66da19002bfd6a68440a079d00728c5796b30
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16362.230000000052 / 16346.709999999983 [+0.09%]
Products
Total CPU difference: 10506.300000000043 / 10516.200000000064 [-0.09%]
Windows-64-VC14:
OCCT
Total CPU difference: 17708.015625 / 17692.25 [+0.09%]
Products
Total CPU difference: 12195.578125 / 12107.796875 [+0.72%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2019-05-19 10:53

administrator   ~0084448

Branch CR30705 has been deleted by inv.

SHA-1: dd45524b5b7a7074ea3cd5fb858d334350f8fbd3

Related Changesets

occt: master 853af31f

2019-05-13 08:31:42

kgv


Committer: bugmaster Details Diff
0030705: Visualization, TKOpenGl - stipple line GLSL error on using OpenGL 2.1 + GL_EXT_gpu_shader4 extension on macOS

Fix compatibility with pure GL_EXT_gpu_shader4 specs by defining "uint" as "unsigned int".
Affected Issues
0030705
mod - src/OpenGl/OpenGl_ShaderManager.cxx Diff File

Issue History

Date Modified Username Field Change
2019-05-10 18:59 Vico Liang New Issue
2019-05-10 18:59 Vico Liang Assigned To => kgv
2019-05-10 19:41 kgv Note Added: 0084288
2019-05-13 10:44 kgv Steps to Reproduce Updated
2019-05-13 11:33 kgv Summary Fragment Shader - syntax error: => Visualization, TKOpenGl - stipple line GLSL error on using OpenGL 2.1 + GL_EXT_gpu_shader4 extension on macOS
2019-05-13 11:39 git Note Added: 0084297
2019-05-13 11:42 kgv Steps to Reproduce Updated
2019-05-13 14:17 kgv Note Added: 0084299
2019-05-13 14:17 kgv Assigned To kgv => osa
2019-05-13 14:17 kgv Status new => resolved
2019-05-13 14:17 kgv Steps to Reproduce Updated
2019-05-13 14:49 kgv Relationship added child of 0025305
2019-05-13 14:50 kgv Product Version => 7.0.0
2019-05-14 11:49 osa Note Added: 0084330
2019-05-14 11:49 osa Assigned To osa => bugmaster
2019-05-14 11:49 osa Status resolved => reviewed
2019-05-15 12:00 bugmaster Note Added: 0084361
2019-05-15 12:00 bugmaster Status reviewed => tested
2019-05-15 12:01 bugmaster Test case number => Not required
2019-05-19 10:40 bugmaster Changeset attached => occt master 853af31f
2019-05-19 10:40 bugmaster Status tested => verified
2019-05-19 10:40 bugmaster Resolution open => fixed
2019-05-19 10:53 git Note Added: 0084448