Text Editor: Add GLSL support language #116793

Closed
Gangneron wants to merge 68 commits from Gangneron/blender:Add_GLSL into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 106 additions and 98 deletions
Showing only changes of commit 95f7553080 - Show all commits

View File

@ -21,105 +21,11 @@
/** \name Local Literal Definitions
* \{ */
Gangneron marked this conversation as resolved Outdated
Use doxy-sections, https://developer.blender.org/docs/handbook/guidelines/c_cpp/#comment-sections
/**
* GLSL builtin functions.
* https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
Gangneron marked this conversation as resolved Outdated

Wrong type.

Wrong type.
*/
Gangneron marked this conversation as resolved Outdated

I don't know what this Array is. And why is it with uppercase A?

I don't know what this `Array` is. And why is it with uppercase `A`?
static const char *text_format_glsl_literals_builtinfunc_data[] = {
/* Force single column, sorted list. */
/* clang-format off */
"attribute",
"bool",
"break",
"buffer",
"bvec2",
"bvec3",
"bvec4",
"case",
"continue",
"default",
"discard",
"do",
"double",
"dmat2",
"dmat2x2",
"dmat2x3",
"dmat2x4",
"dmat3",
"dmat3x2",
"dmat3x3",
"dmat3x4",
"dmat4",
"dmat4x2",
"dmat4x3",
"dmat4x4",
"else",
"flat",
"float",
"for",
"if",
"gvec4",
"highp",
"in",
"int",
"inout",
"ivec2",
"ivec3",
"ivec4",
"layout",
"mat2",
"mat2x2",
"mat2x3",
"mat2x4",
"mat3",
"mat3x2",
"mat3x3",
"mat3x4",
"mat4",
"mat4x2",
"mat4x3",
"mat4x4",
"out",
"precision",
"return",
"sampler",
"sampler1D",
"sampler1DArray",
"sampler1DArrayShadow",
"sampler1DShadow",
"sampler2D",
"sampler2DArrayShadow",
"sampler2DArray",
"sampler2DMSArray",
"sampler2DMS",
"sampler2DRect",
"sampler2DShadow",
"sampler3D",
"samplerBuffer",
"samplerCube" ,
"samplerCubeArray",
"samplerCubeArrayShadow",
"samplerCubeShadow",
"sizeof",
"smooth",
"struct",
"switch",
"texel" ,
"uniform",
"using",
"uvec2",
"uvec3",
"uvec4" ,
"varying",
"vec2",
"vec3",
"vec4",
"void",
"volatile",
"while",
/* clang-format on */
};
static const Span<const char *> text_format_glsl_literals_builtinfunc(
text_format_glsl_literals_builtinfunc_data,
ARRAY_SIZE(text_format_glsl_literals_builtinfunc_data));
static const char *text_format_glsl_literals_reserved_data[] = {
/* Force single column, sorted list. */
/* clang-format off */
"abs",
@ -272,6 +178,108 @@ static const char *text_format_glsl_literals_reserved_data[] = {
"unpackUnorm2x16",
"unpackUnorm4x8",
"usubBorrow",
/* clang-format on */
};
static const Span<const char *> text_format_glsl_literals_builtinfunc(
text_format_glsl_literals_builtinfunc_data,
ARRAY_SIZE(text_format_glsl_literals_builtinfunc_data));
/**
* GLSL reserved keywords.
* https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
*/
static const char *text_format_glsl_literals_reserved_data[] = {
/* Force single column, sorted list. */
/* clang-format off */
"attribute",
"bool",
Gangneron marked this conversation as resolved Outdated

It's ldexp not idexp. If you did this list by hand, other typos might have slept in. So i would suggest to not do manually and use an official list somewhere like https://docs.gl/sl4/acos (left panel, expand all sections).

It's `ldexp` not `idexp`. If you did this list by hand, other typos might have slept in. So i would suggest to not do manually and use an official list somewhere like https://docs.gl/sl4/acos (left panel, expand all sections).
"break",
"buffer",
"bvec2",
"bvec3",
"bvec4",
"case",
"continue",
"default",
"discard",
"do",
"double",
"dmat2",
"dmat2x2",
"dmat2x3",
"dmat2x4",
"dmat3",
"dmat3x2",
"dmat3x3",
"dmat3x4",
"dmat4",
"dmat4x2",
"dmat4x3",
"dmat4x4",
"else",
"flat",
"float",
"for",
"if",
"gvec4",
"highp",
"in",
"int",
"inout",
"ivec2",
"ivec3",
"ivec4",
"layout",
"mat2",
"mat2x2",
"mat2x3",
"mat2x4",
"mat3",
"mat3x2",
"mat3x3",
"mat3x4",
"mat4",
"mat4x2",
"mat4x3",
"mat4x4",
Gangneron marked this conversation as resolved Outdated

These texture*Lod keywords doesn't exist. Only textureLod is valid.

These `texture*Lod` keywords doesn't exist. Only `textureLod` is valid.

i delete keywords

i delete keywords
"out",
"precision",
"return",
"sampler",
"sampler1D",
"sampler1DArray",
"sampler1DArrayShadow",
"sampler1DShadow",
"sampler2D",
"sampler2DArrayShadow",
"sampler2DArray",
"sampler2DMSArray",
"sampler2DMS",
"sampler2DRect",
"sampler2DShadow",
"sampler3D",
"samplerBuffer",
"samplerCube" ,
"samplerCubeArray",
"samplerCubeArrayShadow",
"samplerCubeShadow",
"sizeof",
"smooth",
"struct",
"switch",
"texel" ,
"uniform",
"using",
"uvec2",
"uvec3",
"uvec4" ,
"varying",
"vec2",
"vec3",
"vec4",
"void",
"volatile",
"while",
/* Built-In Variable */
"gl_ClipDistance",