Use push constants for fixed object data, some minor code cleanup
This commit is contained in:
parent
fbc3526c58
commit
e04c084312
9 changed files with 80 additions and 128 deletions
|
|
@ -11,25 +11,24 @@ struct Node
|
|||
uint next;
|
||||
};
|
||||
|
||||
layout (set = 0, binding = 1) uniform ObjectUBO
|
||||
{
|
||||
mat4 model;
|
||||
vec4 color;
|
||||
} objectUBO;
|
||||
|
||||
layout (set = 0, binding = 2) buffer GeometrySBO
|
||||
layout (set = 0, binding = 1) buffer GeometrySBO
|
||||
{
|
||||
uint count;
|
||||
uint maxNodeCount;
|
||||
};
|
||||
|
||||
layout (set = 0, binding = 3, r32ui) uniform uimage2D headIndexImage;
|
||||
layout (set = 0, binding = 2, r32ui) uniform uimage2D headIndexImage;
|
||||
|
||||
layout (set = 0, binding = 4) buffer LinkedListSBO
|
||||
layout (set = 0, binding = 3) buffer LinkedListSBO
|
||||
{
|
||||
Node nodes[];
|
||||
};
|
||||
|
||||
layout(push_constant) uniform PushConsts {
|
||||
mat4 model;
|
||||
vec4 color;
|
||||
} pushConsts;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Increase the node count
|
||||
|
|
@ -42,7 +41,7 @@ void main()
|
|||
uint prevHeadIdx = imageAtomicExchange(headIndexImage, ivec2(gl_FragCoord.xy), nodeIdx);
|
||||
|
||||
// Store node data
|
||||
nodes[nodeIdx].color = objectUBO.color;
|
||||
nodes[nodeIdx].color = pushConsts.color;
|
||||
nodes[nodeIdx].depth = gl_FragCoord.z;
|
||||
nodes[nodeIdx].next = prevHeadIdx;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -8,14 +8,13 @@ layout (set = 0, binding = 0) uniform RenderPassUBO
|
|||
mat4 view;
|
||||
} renderPassUBO;
|
||||
|
||||
layout (set = 0, binding = 1) uniform ObjectUBO
|
||||
{
|
||||
mat4 model;
|
||||
layout(push_constant) uniform PushConsts {
|
||||
mat4 model;
|
||||
vec4 color;
|
||||
} objectUBO;
|
||||
} pushConsts;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 PVM = renderPassUBO.projection * renderPassUBO.view * objectUBO.model;
|
||||
mat4 PVM = renderPassUBO.projection * renderPassUBO.view * pushConsts.model;
|
||||
gl_Position = PVM * vec4(inPos, 1.0);
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue