GLSL 向 C 引入了哪些关键字?

发布于 2024-11-13 11:09:22 字数 435 浏览 3 评论 0原文

那么我们在C中:

auto if break int case long char register
continue return default short do sizeof 
double static else struct entry switch extern
typedef float union for unsigned 
goto while enum void const signed volatile

OpenGL (ES) Shader Language为我们提供了哪些新关键字?

我是 GLSL 新手,我想创建一些突出显示编辑实用程序以方便使用

GLSL 中包含的数学单词将被视为关键字..?

So we have in C:

auto if break int case long char register
continue return default short do sizeof 
double static else struct entry switch extern
typedef float union for unsigned 
goto while enum void const signed volatile

What new keywords OpenGL (ES) Shader Language provide to us?

I am new to GLSL and I want to create some highlight editing util for ease of use.

Math words included into GLSL will count as keywords..?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

跨年 2024-11-20 11:09:22

根据 最新规范的新规范(不包括上面列出的规范)文档

属性统一变化
布局
质心 平坦 光滑 无透视
补丁样本
子程序
输入输出 输入输出
不变的
丢弃
mat2 mat3 mat4 dmat2 dmat3 dmat4
mat2x2 mat2x3 mat2x4 dmat2x2 dmat2x3 dmat2x4
mat3x2 mat3x3 mat3x4 dmat3x2 dmat3x3 dmat3x4
mat4x2 mat4x3 mat4x4 dmat4x2 dmat4x3 dmat4x4
vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 dvec2 dvec3 dvec4
uvec2 uvec3 uvec4
低 中 高精度
采样器1D 采样器2D 采样器3D 采样器Cube
采样器1DSShadow 采样器2DSShadow 采样器CubeShadow
采样器1DArray 采样器2DArray
采样器1DArrayShadow 采样器2DArrayShadow
isampler1D isampler2D isampler3D isamplerCube
isampler1DArray isampler2DArray
usampler1D usampler2D usampler3D usamplerCube
usampler1DArray usampler2DArray
采样器2DRect 采样器2DRectShadow isampler2DRect usampler2DRect
采样器缓冲区 isamplerBuffer usamplerBuffer
采样器2DMS 采样器2DMS 采样器2DMS
sampler2DMSArray isampler2DMSArray usampler2DMSArray
SamplerCubeArray SamplerCubeArrayShadow isamplerCubeArray usamplerCubeArray

保留供将来使用(此时会导致错误):

公共分区处于活动状态
汇编
类联合枚举 typedef 模板此包装
转到
inline noinline 易失性公共静态外部外部接口
长短半固定无符号超级
输入输出
hvec2 hvec3 hvec4 fvec2 fvec3 fvec4
采样器3D矩形
筛选
image1D image2D image3D imageCube
iimage1D iimage2D iimage3D iimageCube
uimage1D uimage2D uimage3D uimageCube
image1DArray image2DArray
iimage1DArray iimage2DArray uimage1DArray uimage2DArray
image1DShadow image2DShadow
image1DArrayShadow image2DArrayShadow
imageBuffer iimageBuffer uimageBuffer
铸件尺寸
命名空间使用
行主要

New ones (excluding the ones you listed above) according to the latest spec document:

attribute uniform varying
layout
centroid flat smooth noperspective
patch sample
subroutine
in out inout
invariant
discard
mat2 mat3 mat4 dmat2 dmat3 dmat4
mat2x2 mat2x3 mat2x4 dmat2x2 dmat2x3 dmat2x4
mat3x2 mat3x3 mat3x4 dmat3x2 dmat3x3 dmat3x4
mat4x2 mat4x3 mat4x4 dmat4x2 dmat4x3 dmat4x4
vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 dvec2 dvec3 dvec4
uvec2 uvec3 uvec4
lowp mediump highp precision
sampler1D sampler2D sampler3D samplerCube
sampler1DShadow sampler2DShadow samplerCubeShadow
sampler1DArray sampler2DArray
sampler1DArrayShadow sampler2DArrayShadow
isampler1D isampler2D isampler3D isamplerCube
isampler1DArray isampler2DArray
usampler1D usampler2D usampler3D usamplerCube
usampler1DArray usampler2DArray
sampler2DRect sampler2DRectShadow isampler2DRect usampler2DRect
samplerBuffer isamplerBuffer usamplerBuffer
sampler2DMS isampler2DMS usampler2DMS
sampler2DMSArray isampler2DMSArray usampler2DMSArray
samplerCubeArray samplerCubeArrayShadow isamplerCubeArray usamplerCubeArray

Reserved for future use (will cause error at the moment):

common partition active
asm
class union enum typedef template this packed
goto
inline noinline volatile public static extern external interface
long short half fixed unsigned superp
input output
hvec2 hvec3 hvec4 fvec2 fvec3 fvec4
sampler3DRect
filter
image1D image2D image3D imageCube
iimage1D iimage2D iimage3D iimageCube
uimage1D uimage2D uimage3D uimageCube
image1DArray image2DArray
iimage1DArray iimage2DArray uimage1DArray uimage2DArray
image1DShadow image2DShadow
image1DArrayShadow image2DArrayShadow
imageBuffer iimageBuffer uimageBuffer
sizeof cast
namespace using
row_major

贱贱哒 2024-11-20 11:09:22

您可能想要获取 OpenGL ES GLSL 语言规范 。 §3.6 列出了关键字(加上一些不是关键字的保留字,但无论如何你都不应该使用它们,所以它们可能也值得某种颜色编码)。

编辑:哎呀,我抓住了错误的链接。我很抱歉。当前规范为:

OpenGL 4.1 GLSL
OpenGL ES 2.0 GLSL

You probably want to get the OpenGL ES GLSL language specification. §3.6 lists the keywords (plus a number of reserved words that aren't keywords, but you're not supposed to use anyway, so they probably merit some sort of color coding as well).

Edit: Oops, I grabbed the wrong link there. My apologies. The current specs are:

OpenGL 4.1 GLSL
OpenGL ES 2.0 GLSL

信愁 2024-11-20 11:09:22

除了上述答案之外,还有保留的标识符,例如。在 GLSL ES 3.0 规范 中:

gl_ 开头的标识符保留供 OpenGL ES 使用,并且不能在着色器中声明为变量或函数。重新声明变量是错误的,包括那些以“gl_”开头的变量。

除此之外的其他内容也被保留:

此外,所有包含两个连续下划线(__)的标识符都保留供底层软件层使用。在着色器中定义这样的名称本身不会导致错误,但可能会导致由于具有相同名称的多个定义而导致的意外行为。

它与语法着色和正确性检查相关。
同样,以 GL_ 开头的宏,以及一堆以 __ 开头的东西。

Besides the above answers, there are also reserved identifiers, eg. in GLSL ES 3.0 spec:

Identifiers starting with gl_ are reserved for use by OpenGL ES, and may not be declared in a shader as either a variable or a function. It is an error to redeclare a variable, including those starting “gl_”.

And other things beyond these are reserved:

In addition, all identifiers containing two consecutive underscores (__) are reserved for use by underlying software layers. Defining such a name in a shader does not itself result in an error, but may result in unintended behaviors that stem from having multiple definitions of the same name.

It is relevant for syntax coloring and correctness checking.
Similarly, macros starting with GL_, and a bunch of things with __.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文