0

所以,我最近发现了一个有趣的着色器并尝试编译它。

但是,GLSL 编译器抛出了以下错误:

ERROR: 0:50: error(#132) Syntax error: "layout" parse error

@(片段着色器)

#version 420

...

uint ImageAtomic_Average_RGBA8(layout (r32ui) volatile uimage3D Img, ivec3 Coords, vec4 NewVal)
{ ... }

细节:

  • 显卡:AMD Radeon HD 7870(支持OpenGL 4.20)
  • 我尝试了 4.2 驱动程序和 4.3 beta 驱动程序。
4

1 回答 1

1

A layout qualifier cannot be part of the function's signature. Section 6.1.1 of the GLSL 4.40 Specification defines the following grammar for a function prototype:

function-prototype :
precision-qualifier type function-name(*parameter-qualifiers* precision-qualifier type name array-specifier, ... )

Now, a parameter-qualifier can be one of

const
in
out
inout
precise
memory qualifier (volatile, ...)
precision qualifier(lowp, ...)


Consistently, section 4.10 explicitly states:

Layout qualifiers cannot be used on formal function parameters [..]

If you drop the layout qualifier, you should be fine. If not, it's a driver bug.

于 2013-09-30T08:36:07.480 回答