1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0031253: Visualization, TKOpenGl - phong shading GLSL compilation fail on Adreno 308

Removed initialization of global Normal variable outside of main() block.
occLight_IsHeadlight() flag is now packed into occLight_Position().w
This commit is contained in:
kgv
2019-12-19 00:11:55 +03:00
committed by bugmaster
parent 9a1701fbcb
commit 9504a30d15
6 changed files with 80 additions and 114 deletions

View File

@@ -139,19 +139,22 @@ uniform vec4 occLightAmbient; //!< Cumulative ambient color
uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources
//! Type of light source, int (see OccLightType enum).
#define occLight_Type(theId) occLightSourcesTypes[theId].x
#define occLight_Type(theId) occLightSourcesTypes[theId]
//! Is light a headlight, int?
#define occLight_IsHeadlight(theId) (occLightSourcesTypes[theId].y != 0)
//! Specular intensity (equals to diffuse), vec3.
#define occLight_Specular(theId) occLightSources[theId * 4 + 0].rgb
//! Specular intensity (equals to diffuse), vec4.
#define occLight_Specular(theId) occLightSources[theId * 4 + 0]
//! Intensity of light source (>= 0), float.
#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a
//! Position of specified light source, vec4.
#define occLight_Position(theId) occLightSources[theId * 4 + 1]
//! Is light a headlight, bool?
#define occLight_IsHeadlight(theId) (occLightSources[theId * 4 + 1].w > 0.5)
//! Direction of specified spot light source, vec4.
#define occLight_SpotDirection(theId) occLightSources[theId * 4 + 2]
//! Position of specified light source, vec3.
#define occLight_Position(theId) occLightSources[theId * 4 + 1].xyz
//! Direction of specified spot light source, vec3.
#define occLight_SpotDirection(theId) occLightSources[theId * 4 + 2].xyz
//! Maximum spread angle of the spot light (in radians), float.
#define occLight_SpotCutOff(theId) occLightSources[theId * 4 + 3].z
@@ -159,13 +162,9 @@ uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sour
//! Attenuation of the spot light intensity (from 0 to 1), float.
#define occLight_SpotExponent(theId) occLightSources[theId * 4 + 3].w
#if defined(THE_IS_PBR)
//! Intensity of light source (>= 0), float.
#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a
#else
//! Diffuse intensity (equals to Specular), vec4.
#define occLight_Diffuse(theId) occLightSources[theId * 4 + 0]
#if !defined(THE_IS_PBR)
//! Diffuse intensity (equals to Specular), vec3.
#define occLight_Diffuse(theId) occLightSources[theId * 4 + 0].rgb
//! Const attenuation factor of positional light source, float.
#define occLight_ConstAttenuation(theId) occLightSources[theId * 4 + 3].x

View File

@@ -19,8 +19,8 @@ void occSetFragColor (in vec4 theColor)
#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
// arrays of light sources
uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters
uniform THE_PREC_ENUM ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types
uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters
uniform THE_PREC_ENUM int occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types
#endif
#if defined(THE_IS_PBR)

View File

@@ -22,8 +22,8 @@ static const char Shaders_DeclarationsImpl_glsl[] =
"\n"
"#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)\n"
"// arrays of light sources\n"
"uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters\n"
"uniform THE_PREC_ENUM ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types\n"
"uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters\n"
"uniform THE_PREC_ENUM int occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types\n"
"#endif\n"
"\n"
"#if defined(THE_IS_PBR)\n"

View File

@@ -142,19 +142,22 @@ static const char Shaders_Declarations_glsl[] =
"uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources\n"
"\n"
"//! Type of light source, int (see OccLightType enum).\n"
"#define occLight_Type(theId) occLightSourcesTypes[theId].x\n"
"#define occLight_Type(theId) occLightSourcesTypes[theId]\n"
"\n"
"//! Is light a headlight, int?\n"
"#define occLight_IsHeadlight(theId) (occLightSourcesTypes[theId].y != 0)\n"
"//! Specular intensity (equals to diffuse), vec3.\n"
"#define occLight_Specular(theId) occLightSources[theId * 4 + 0].rgb\n"
"\n"
"//! Specular intensity (equals to diffuse), vec4.\n"
"#define occLight_Specular(theId) occLightSources[theId * 4 + 0]\n"
"//! Intensity of light source (>= 0), float.\n"
"#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a\n"
"\n"
"//! Position of specified light source, vec4.\n"
"#define occLight_Position(theId) occLightSources[theId * 4 + 1]\n"
"//! Is light a headlight, bool?\n"
"#define occLight_IsHeadlight(theId) (occLightSources[theId * 4 + 1].w > 0.5)\n"
"\n"
"//! Direction of specified spot light source, vec4.\n"
"#define occLight_SpotDirection(theId) occLightSources[theId * 4 + 2]\n"
"//! Position of specified light source, vec3.\n"
"#define occLight_Position(theId) occLightSources[theId * 4 + 1].xyz\n"
"\n"
"//! Direction of specified spot light source, vec3.\n"
"#define occLight_SpotDirection(theId) occLightSources[theId * 4 + 2].xyz\n"
"\n"
"//! Maximum spread angle of the spot light (in radians), float.\n"
"#define occLight_SpotCutOff(theId) occLightSources[theId * 4 + 3].z\n"
@@ -162,13 +165,9 @@ static const char Shaders_Declarations_glsl[] =
"//! Attenuation of the spot light intensity (from 0 to 1), float.\n"
"#define occLight_SpotExponent(theId) occLightSources[theId * 4 + 3].w\n"
"\n"
"#if defined(THE_IS_PBR)\n"
"//! Intensity of light source (>= 0), float.\n"
"#define occLight_Intensity(theId) occLightSources[theId * 4 + 0].a\n"
"#else\n"
"\n"
"//! Diffuse intensity (equals to Specular), vec4.\n"
"#define occLight_Diffuse(theId) occLightSources[theId * 4 + 0]\n"
"#if !defined(THE_IS_PBR)\n"
"//! Diffuse intensity (equals to Specular), vec3.\n"
"#define occLight_Diffuse(theId) occLightSources[theId * 4 + 0].rgb\n"
"\n"
"//! Const attenuation factor of positional light source, float.\n"
"#define occLight_ConstAttenuation(theId) occLightSources[theId * 4 + 3].x\n"