Skip to content

Commit 6b7675d

Browse files
committed
GL3Plus: offset mesh SSBO binding by 3
to give room for meshlet buffers. Also UBOs work now with gl_spirv
1 parent 584bb36 commit 6b7675d

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

Docs/src/high-level-programs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ refer to the following table for the location indices and names to use:
131131
132132
## Buffers in Mesh Shaders {#GLSL-Mesh-Shaders}
133133
134-
With mesh shaders the input assembly stage is skipped and hence the vertex attributes are not available. Instead, %Ogre will bind the vertex buffers as SSBOs to a binding point defined by the Ogre::VertexBufferBinding index.
134+
With mesh shaders the input assembly stage is skipped and hence the vertex attributes are not available. Instead, %Ogre will bind the vertex buffers as SSBOs to a binding point defined by the Ogre::VertexBufferBinding index, offset by 3.
135135
136136
In the shader you can access the buffer as follows:
137137

RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ namespace Ogre {
10091009
for(auto it : op.vertexData->vertexBufferBinding->getBindings())
10101010
{
10111011
auto buf = it.second->_getImpl<GL3PlusHardwareBuffer>();
1012-
buf->setGLBufferBinding(it.first, GL_SHADER_STORAGE_BUFFER);
1012+
buf->setGLBufferBinding(it.first + 3, GL_SHADER_STORAGE_BUFFER);
10131013
}
10141014
}
10151015

Samples/Media/materials/programs/GLSL400/MeshProgram.glsl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ layout(location=0) out PerVertexData
1717
vec3 color;
1818
} v_out[];
1919

20-
#ifdef VULKAN
2120
layout(binding=0, row_major) uniform OgreUniforms
2221
{
2322
mat4 MVP;
2423
float t;
2524
};
2625

26+
#ifdef VULKAN
2727
// SSBOs cannot be used with Vulkan yet
2828
float data[] = {
2929
-100, -100, 0, // pos
@@ -40,13 +40,9 @@ float data[] = {
4040
0,0
4141
};
4242
#else
43-
// UBOs cannot be used with gl_spirv yet
44-
layout(location=0) uniform mat4 MVP;
45-
layout(location=4) uniform float t;
46-
4743
//![vertexbuffer]
4844
// buffer at index 0, which is expected to contain float data
49-
layout(binding = 0) buffer VertexDataIn
45+
layout(binding = 3) readonly buffer VertexDataIn
5046
{
5147
float data[];
5248
};

0 commit comments

Comments
 (0)