fixed intel graphical issues

This commit is contained in:
Harrison Corlett 2026-09-18 13:56:17 +01:00
parent 95a27cfd50
commit 7fda2614d7
4 changed files with 47 additions and 2 deletions

View file

@ -42,6 +42,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.lwjgl.glfw.GLFW.glfwShowWindow;
import static org.lwjgl.vulkan.VK13.*;
public class VulkanRenderer implements Renderer {
@ -92,6 +93,8 @@ public class VulkanRenderer implements Renderer {
public boolean GetDeferred(){return Deferred;}
private boolean Initiated = false;
public VulkanRenderer(EngineInstance engineInstance) {
engineInstance.scene().GetProjection().SetFarPlanes();
Deferred = EngineConfig.getInstance().DeferredRendering();
@ -314,6 +317,10 @@ public class VulkanRenderer implements Renderer {
}
public void render(EngineInstance engineInstance){
if(!Initiated){
glfwShowWindow(engineInstance.window().getHandle());
Initiated = true;
}
if(! RenderThread.AllowRender()) return;
if (RebuildShadowsRequested) {

View file

@ -143,6 +143,9 @@ public class Window {
glfwWindowHint(GLFW_ALPHA_BITS, 0);
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE);
handle = glfwCreateWindow(width, height, title, MemoryUtil.NULL, MemoryUtil.NULL);
if(LinkedApi == EngineConfig.RenderAPI.Vulkan){
glfwHideWindow(handle);
}
if (glfwRawMouseMotionSupported()) {
glfwSetInputMode(handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
}
@ -181,7 +184,6 @@ public class Window {
IconBuffer.free(); //free the buffer once icon is set so when the program closes there isn't memory still floating around
Logger.debug("Freeing icon Buffer");
glfwSetWindowFocusCallback(handle, new GLFWWindowFocusCallback() {
@Override
public void invoke(long window, boolean focused) {
@ -203,6 +205,8 @@ public class Window {
} else {
glfwSwapInterval(0);
}
} else{
glfwHideWindow(handle);
}
mouseInput = new MouseListener(handle);
}

View file

@ -1,6 +1,7 @@
package net.halbear.Terrain4J.EngineCore.RenderingAPI.Vulkan.Rendering.Shader;
import net.halbear.Terrain4J.EngineCore.Logic.Rendering.VulkanContext;
import net.halbear.Terrain4J.EngineCore.RenderingAPI.Vulkan.Structure.DeviceLayers.Device;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.vulkan.VkSamplerCreateInfo;
@ -30,10 +31,15 @@ public class TextureSampler {
.minLod(0.0f)
.maxLod(textureSamplerInfo.MipLevels())
.mipLodBias(0.0f);
if(textureSamplerInfo.Anisotropy() && VkCtx.GetDevice().SamplesAnisotropy()){
if(textureSamplerInfo.Anisotropy() && VkCtx.GetDevice().SamplesAnisotropy()
&& VkCtx.GetDevice().GetVendor() != Device.GPU_VENDOR.INTEL){
SamplerInfo
.anisotropyEnable(true)
.maxAnisotropy(MAX_ANISOTROPY);
} else{
SamplerInfo
.anisotropyEnable(false)
.maxAnisotropy(1.0f);
}
LongBuffer LongPointer = MemStack.mallocLong(1);
vkCheck(vkCreateSampler(VkCtx.GetDevice().FetchVulkanDevice(), SamplerInfo,null,LongPointer)

View file

@ -23,8 +23,22 @@ public class Device {
private final boolean depthClamp;
private final VkDevice VulkanDevice;
private final boolean SamplesAnisotropy;
public static final int VENDOR_AMD = 0x1002;
public static final int VENDOR_NVIDIA = 0x10DE;
public static final int VENDOR_INTEL = 0x8086;
private final String DeviceName;
private final GPU_VENDOR Vendor;
public enum GPU_VENDOR{
AMD,
NVIDIA,
INTEL,
UNKNOWN
}
public Device(PhysicalDevice PhysDevice){
Logger.debug("Creating Device Interface Layer");
try (var MemStack = MemoryStack.stackPush()) {
PointerBuffer RequiredExtensions = CreateRequiredExtensions(PhysDevice, MemStack);
@ -71,6 +85,16 @@ public class Device {
VkPhysicalDeviceProperties deviceProps = VkPhysicalDeviceProperties.malloc();
vkGetPhysicalDeviceProperties(PhysDevice.GetPhysicalDevice(), deviceProps);
int VendorID = deviceProps.vendorID();
DeviceName = deviceProps.deviceNameString();
switch(VendorID){
case VENDOR_INTEL -> Vendor = GPU_VENDOR.INTEL;
case VENDOR_AMD -> Vendor = GPU_VENDOR.AMD;
case VENDOR_NVIDIA -> Vendor = GPU_VENDOR.NVIDIA;
default -> Vendor = GPU_VENDOR.UNKNOWN;
}
if (!deviceProps.limits().timestampComputeAndGraphics()) {
Logger.warn("GPU does not support timestamp queries!");
}
@ -80,6 +104,10 @@ public class Device {
}
}
public GPU_VENDOR GetVendor(){return Vendor;}
public String GetDeviceName(){return DeviceName;}
public boolean getDepthClamp() {
return depthClamp;
}