what if minecraft ran on the GPU exclusively? glad you asked! because now it can

This commit is contained in:
Halbear 2026-09-15 20:49:24 +01:00
parent fa7bf893e7
commit bf9af81f38
41 changed files with 2433 additions and 34 deletions

View file

@ -0,0 +1,42 @@
#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;
}