Skip to content

Some compatibility fixes #567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
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