OpenGL ES 和 Spir-V 中的只读存储缓冲区
read-only storage buffer in OpenGL ES and Spir-V
在 OpenGL ES 着色语言中,着色器存储缓冲区对象 (SSBO) 可以用修饰符 readonly
或 writeonly
.
修饰
OpenGL ES Shading Language version 3.1 specification 的第 4.9 节(内存访问限定符):
Shader storage blocks, variables declared within shader storage blocks and variables declared as image types (the basic opaque types with “image” in their keyword), can be further qualified with one or more of the following memory qualifiers: ...(A table is listed)
所以我可以在 opengl es 着色器中有这样的东西:
layout(std430, binding = 0) readonly buffer mybuffer {
a_struct_type myarray[]; //a_struct_type was defined before
};
但是在spir-v中如何指定readonly?
在 spir-v specification,3.18 部分,访问限定符,它说:
Used by OpTypeImage and OpTypePipe.
这是否意味着在spir-v中,SSBO不能指定为readonly?我认为 SSBO 不属于 OpTypeImage 或 OpTypePipe 类型。
---------------------------------------------
Resource Type | Storage Class | Type
---------------------------------------------
Storage Buffer| Uniform |
|----------------| OpTypeStruct
| Storage Buffer |
----------------------------------------------
适当的decorations不直观是NonWritable
和NonReadable
。
在 OpenGL ES 着色语言中,着色器存储缓冲区对象 (SSBO) 可以用修饰符 readonly
或 writeonly
.
修饰
OpenGL ES Shading Language version 3.1 specification 的第 4.9 节(内存访问限定符):
Shader storage blocks, variables declared within shader storage blocks and variables declared as image types (the basic opaque types with “image” in their keyword), can be further qualified with one or more of the following memory qualifiers: ...(A table is listed)
所以我可以在 opengl es 着色器中有这样的东西:
layout(std430, binding = 0) readonly buffer mybuffer {
a_struct_type myarray[]; //a_struct_type was defined before
};
但是在spir-v中如何指定readonly?
在 spir-v specification,3.18 部分,访问限定符,它说:
Used by OpTypeImage and OpTypePipe.
这是否意味着在spir-v中,SSBO不能指定为readonly?我认为 SSBO 不属于 OpTypeImage 或 OpTypePipe 类型。
---------------------------------------------
Resource Type | Storage Class | Type
---------------------------------------------
Storage Buffer| Uniform |
|----------------| OpTypeStruct
| Storage Buffer |
----------------------------------------------
适当的decorations不直观是NonWritable
和NonReadable
。