Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ abstract class GlslMatrix(node: ASTNode) : GlslBuiltinType(node) {
when (other) {
is GlslScalar -> return this
is GlslVector -> {
if (operation == "*") return this
if (operation == "*") return other
val msg = GlslErrorCode.DOES_NOT_OPERATE_ON.message.format(operation, name, other.name)
glslError = GlslError(GlslErrorCode.DOES_NOT_OPERATE_ON, msg)
return this
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/glsl/plugin/utils/GlslBuiltinUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.intellij.openapi.project.ProjectManager
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.util.PsiTreeUtil.findChildOfType
import com.intellij.psi.util.PsiTreeUtil.findChildrenOfType
import com.intellij.psi.util.findParentOfType
import glsl.data.ShaderType
import glsl.data.ShaderType.*
import glsl.plugin.language.GlslFile
Expand Down Expand Up @@ -111,7 +112,7 @@ object GlslBuiltinUtils {
*/
private fun setShaderVariables() {
val shaderVariablesFile = getBuiltinFile("glsl-shader-variables")
val structSpecifiers = findChildrenOfType(shaderVariablesFile, GlslStructSpecifier::class.java).toList()
val structSpecifiers = findChildrenOfType(shaderVariablesFile, GlslStructSpecifier::class.java).filter { it.findParentOfType<GlslStructSpecifier>() == null }.toList()
// Initializes map with ShaderType enum
shaderVariables = EnumMap(ShaderType::class.java)
val allShaderVariables = hashMapOf<String, GlslNamedVariable>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1962,3 +1962,4 @@ uint usubBorrow(highp uint x, highp uint y, out lowp uint borrow);
uvec2 usubBorrow(highp uvec2 x, highp uvec2 y, out lowp uvec2 borrow);
uvec3 usubBorrow(highp uvec3 x, highp uvec3 y, out lowp uvec3 borrow);
uvec4 usubBorrow(highp uvec4 x, highp uvec4 y, out lowp uvec4 borrow);
vec4 ftransform();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that the functions are alphabetically sorted

97 changes: 96 additions & 1 deletion src/main/resources/builtin-objects/glsl-shader-variables.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,99 @@ struct TESE {
in vec3 gl_TessCoord;
patch in float gl_TessLevelOuter[4];
patch in float gl_TessLevelInner[2];
};
};

//Compatibility profile
struct COMPAT {
mat4 gl_ModelViewMatrix;
mat4 gl_ProjectionMatrix;
mat4 gl_ModelViewProjectionMatrix;
mat4 gl_TextureMatrix[];
mat3 gl_NormalMatrix;
mat4 gl_ModelViewMatrixInverse;
mat4 gl_ProjectionMatrixInverse;
mat4 gl_ModelViewProjectionMatrixInverse;
mat4 gl_TextureMatrixInverse[];
mat4 gl_ModelViewMatrixTranspose;
mat4 gl_ProjectionMatrixTranspose;
mat4 gl_ModelViewProjectionMatrixTranspose;
mat4 gl_TextureMatrixTranspose[];
mat4 gl_ModelViewMatrixInverseTranspose;
mat4 gl_ProjectionMatrixInverseTranspose;
mat4 gl_ModelViewProjectionMatrixInverseTranspose;
mat4 gl_TextureMatrixInverseTranspose[];
float gl_NormalScale;
vec4 gl_ClipPlane[];
struct gl_PointParameters {
float size;
float sizeMin;
float sizeMax;
float fadeThresholdSize;
float distanceConstantAttenuation;
float distanceLinearAttenuation;
float distanceQuadraticAttenuation;
} gl_Point;
struct gl_MaterialParameters {
vec4 emission;
vec4 ambient;
vec4 diffuse;
vec4 specular;
float shininess;
} gl_FrontMaterial;
struct gl_MaterialParameters {
vec4 emission;
vec4 ambient;
vec4 diffuse;
vec4 specular;
float shininess;
} gl_BackMaterial;
struct gl_LightSourceParameters {
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec4 position;
vec4 halfVector;
vec3 spotDirection;
float spotExponent;
float spotCutoff;
float spotCosCutoff;
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
} gl_LightSource[];
struct gl_LightModelParameters {
vec4 ambient;
} gl_LightModel;
struct gl_LightModelProducts {
vec4 sceneColor;
} gl_FrontLightModelProduct;
struct gl_LightModelProducts {
vec4 sceneColor;
} gl_BackLightModelProduct;
struct gl_LightProducts {
vec4 ambient;
vec4 diffuse;
vec4 specular;
} gl_FrontLightProduct[];
struct gl_LightProducts {
vec4 ambient;
vec4 diffuse;
vec4 specular;
} gl_BackLightProduct[];
vec4 gl_TextureEnvColor[];
vec4 gl_EyePlaneS[];
vec4 gl_EyePlaneT[];
vec4 gl_EyePlaneR[];
vec4 gl_EyePlaneQ[];
vec4 gl_ObjectPlaneS[];
vec4 gl_ObjectPlaneT[];
vec4 gl_ObjectPlaneR[];
vec4 gl_ObjectPlaneQ[];
struct gl_FogParameters {
vec4 color;
float density;
float start;
float end;
float scale;
} gl_Fog;
}
Loading