42 lines
No EOL
1,013 B
GLSL
42 lines
No EOL
1,013 B
GLSL
#version 460
|
|
|
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
const uint FLOATS_PER_VERTEX = 14u;
|
|
|
|
struct DrawCommand {
|
|
uint indexCount;
|
|
uint instanceCount;
|
|
uint firstIndex;
|
|
int vertexOffset;
|
|
uint firstInstance;
|
|
};
|
|
|
|
layout(std430, binding = 0) buffer DrawCommands {
|
|
DrawCommand drawCmds[];
|
|
};
|
|
|
|
layout(std430, binding = 1) buffer Counters {
|
|
uint vertexCount;
|
|
uint indexCount;
|
|
} counters;
|
|
|
|
layout(push_constant) uniform ChunkInfo {
|
|
ivec3 chunkPos;
|
|
int slot;
|
|
uint vertexFloatOffset;
|
|
uint indexOffset;
|
|
uint indirectCommandIndex;
|
|
uint padding0;
|
|
};
|
|
|
|
void main() {
|
|
drawCmds[indirectCommandIndex].indexCount = 0u;
|
|
drawCmds[indirectCommandIndex].instanceCount = 1u;
|
|
drawCmds[indirectCommandIndex].firstIndex = indexOffset;
|
|
drawCmds[indirectCommandIndex].vertexOffset = int(vertexFloatOffset / FLOATS_PER_VERTEX);
|
|
drawCmds[indirectCommandIndex].firstInstance = 0u;
|
|
|
|
counters.vertexCount = 0u;
|
|
counters.indexCount = 0u;
|
|
} |