Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ private int getMask(Vec3 camera, RenderSection section) {
public void bindBuffers(VkCommandBuffer commandBuffer, Pipeline pipeline, TerrainRenderType terrainRenderType, double camX, double camY, double camZ) {
try (MemoryStack stack = MemoryStack.stackPush()) {
var vertexBuffer = getAreaBuffer(terrainRenderType);
nvkCmdBindVertexBuffers(commandBuffer, 0, 1, stack.npointer(vertexBuffer.getId()), stack.npointer(0));
// VkBuffer is either a 64-bit unsigned integer or a 64-bit pointer, and
// VkDeviceSize is always an uint64_t. Both are equivalent to a Java "long",
// so use "stack.nlong" here.
nvkCmdBindVertexBuffers(commandBuffer, 0, 1, stack.nlong(vertexBuffer.getId()), stack.nlong(0));
updateChunkAreaOrigin(commandBuffer, pipeline, camX, camY, camZ, stack);
}

Expand Down
14 changes: 13 additions & 1 deletion src/main/java/net/vulkanmod/vulkan/framebuffer/SwapChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,19 @@ private void createSwapChain() {
}

createInfo.preTransform(surfaceProperties.capabilities.currentTransform());
createInfo.compositeAlpha(VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR);

int supportedCompositeAlpha = surfaceProperties.capabilities.supportedCompositeAlpha();
if((supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR) != 0) {
createInfo.compositeAlpha(VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR);
}else if((supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR) != 0){
// PowerVR GE8320 Vulkan drivers don't support the alpha composite opaque bit.
// In that case, use the inherit mode if supported.
createInfo.compositeAlpha(VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR);
} else {
// Not sure how to handle the other cases, to be honest...
throw new RuntimeException("Neither opaque, nor inherited alpha compositing modes are supported.");
}

createInfo.presentMode(presentMode);
createInfo.clipped(true);

Expand Down