Skip to content

Commit 9c3fd2c

Browse files
committed
Fix incorrect usage of stack.npointer when binding buffers.
1 parent 7e34000 commit 9c3fd2c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/net/vulkanmod/render/chunk/buffer/DrawBuffers.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ private int getMask(Vec3 camera, RenderSection section) {
365365
public void bindBuffers(VkCommandBuffer commandBuffer, Pipeline pipeline, TerrainRenderType terrainRenderType, double camX, double camY, double camZ) {
366366
try (MemoryStack stack = MemoryStack.stackPush()) {
367367
var vertexBuffer = getAreaBuffer(terrainRenderType);
368-
nvkCmdBindVertexBuffers(commandBuffer, 0, 1, stack.npointer(vertexBuffer.getId()), stack.npointer(0));
368+
// VkBuffer is either a 64-bit unsigned integer or a 64-bit pointer, and
369+
// VkDeviceSize is always an uint64_t. Both are equivalent to a Java "long",
370+
// so use "stack.nlong" here.
371+
nvkCmdBindVertexBuffers(commandBuffer, 0, 1, stack.nlong(vertexBuffer.getId()), stack.nlong(0));
369372
updateChunkAreaOrigin(commandBuffer, pipeline, camX, camY, camZ, stack);
370373
}
371374

0 commit comments

Comments
 (0)