fixed intel graphical issues
This commit is contained in:
parent
95a27cfd50
commit
7fda2614d7
4 changed files with 47 additions and 2 deletions
|
|
@ -42,6 +42,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.lwjgl.glfw.GLFW.glfwShowWindow;
|
||||||
import static org.lwjgl.vulkan.VK13.*;
|
import static org.lwjgl.vulkan.VK13.*;
|
||||||
|
|
||||||
public class VulkanRenderer implements Renderer {
|
public class VulkanRenderer implements Renderer {
|
||||||
|
|
@ -92,6 +93,8 @@ public class VulkanRenderer implements Renderer {
|
||||||
|
|
||||||
public boolean GetDeferred(){return Deferred;}
|
public boolean GetDeferred(){return Deferred;}
|
||||||
|
|
||||||
|
private boolean Initiated = false;
|
||||||
|
|
||||||
public VulkanRenderer(EngineInstance engineInstance) {
|
public VulkanRenderer(EngineInstance engineInstance) {
|
||||||
engineInstance.scene().GetProjection().SetFarPlanes();
|
engineInstance.scene().GetProjection().SetFarPlanes();
|
||||||
Deferred = EngineConfig.getInstance().DeferredRendering();
|
Deferred = EngineConfig.getInstance().DeferredRendering();
|
||||||
|
|
@ -314,6 +317,10 @@ public class VulkanRenderer implements Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(EngineInstance engineInstance){
|
public void render(EngineInstance engineInstance){
|
||||||
|
if(!Initiated){
|
||||||
|
glfwShowWindow(engineInstance.window().getHandle());
|
||||||
|
Initiated = true;
|
||||||
|
}
|
||||||
if(! RenderThread.AllowRender()) return;
|
if(! RenderThread.AllowRender()) return;
|
||||||
|
|
||||||
if (RebuildShadowsRequested) {
|
if (RebuildShadowsRequested) {
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,9 @@ public class Window {
|
||||||
glfwWindowHint(GLFW_ALPHA_BITS, 0);
|
glfwWindowHint(GLFW_ALPHA_BITS, 0);
|
||||||
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE);
|
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE);
|
||||||
handle = glfwCreateWindow(width, height, title, MemoryUtil.NULL, MemoryUtil.NULL);
|
handle = glfwCreateWindow(width, height, title, MemoryUtil.NULL, MemoryUtil.NULL);
|
||||||
|
if(LinkedApi == EngineConfig.RenderAPI.Vulkan){
|
||||||
|
glfwHideWindow(handle);
|
||||||
|
}
|
||||||
if (glfwRawMouseMotionSupported()) {
|
if (glfwRawMouseMotionSupported()) {
|
||||||
glfwSetInputMode(handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
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
|
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");
|
Logger.debug("Freeing icon Buffer");
|
||||||
|
|
||||||
glfwSetWindowFocusCallback(handle, new GLFWWindowFocusCallback() {
|
glfwSetWindowFocusCallback(handle, new GLFWWindowFocusCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void invoke(long window, boolean focused) {
|
public void invoke(long window, boolean focused) {
|
||||||
|
|
@ -203,6 +205,8 @@ public class Window {
|
||||||
} else {
|
} else {
|
||||||
glfwSwapInterval(0);
|
glfwSwapInterval(0);
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
glfwHideWindow(handle);
|
||||||
}
|
}
|
||||||
mouseInput = new MouseListener(handle);
|
mouseInput = new MouseListener(handle);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package net.halbear.Terrain4J.EngineCore.RenderingAPI.Vulkan.Rendering.Shader;
|
package net.halbear.Terrain4J.EngineCore.RenderingAPI.Vulkan.Rendering.Shader;
|
||||||
|
|
||||||
import net.halbear.Terrain4J.EngineCore.Logic.Rendering.VulkanContext;
|
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.system.MemoryStack;
|
||||||
import org.lwjgl.vulkan.VkSamplerCreateInfo;
|
import org.lwjgl.vulkan.VkSamplerCreateInfo;
|
||||||
|
|
||||||
|
|
@ -30,10 +31,15 @@ public class TextureSampler {
|
||||||
.minLod(0.0f)
|
.minLod(0.0f)
|
||||||
.maxLod(textureSamplerInfo.MipLevels())
|
.maxLod(textureSamplerInfo.MipLevels())
|
||||||
.mipLodBias(0.0f);
|
.mipLodBias(0.0f);
|
||||||
if(textureSamplerInfo.Anisotropy() && VkCtx.GetDevice().SamplesAnisotropy()){
|
if(textureSamplerInfo.Anisotropy() && VkCtx.GetDevice().SamplesAnisotropy()
|
||||||
|
&& VkCtx.GetDevice().GetVendor() != Device.GPU_VENDOR.INTEL){
|
||||||
SamplerInfo
|
SamplerInfo
|
||||||
.anisotropyEnable(true)
|
.anisotropyEnable(true)
|
||||||
.maxAnisotropy(MAX_ANISOTROPY);
|
.maxAnisotropy(MAX_ANISOTROPY);
|
||||||
|
} else{
|
||||||
|
SamplerInfo
|
||||||
|
.anisotropyEnable(false)
|
||||||
|
.maxAnisotropy(1.0f);
|
||||||
}
|
}
|
||||||
LongBuffer LongPointer = MemStack.mallocLong(1);
|
LongBuffer LongPointer = MemStack.mallocLong(1);
|
||||||
vkCheck(vkCreateSampler(VkCtx.GetDevice().FetchVulkanDevice(), SamplerInfo,null,LongPointer)
|
vkCheck(vkCreateSampler(VkCtx.GetDevice().FetchVulkanDevice(), SamplerInfo,null,LongPointer)
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,22 @@ public class Device {
|
||||||
private final boolean depthClamp;
|
private final boolean depthClamp;
|
||||||
private final VkDevice VulkanDevice;
|
private final VkDevice VulkanDevice;
|
||||||
private final boolean SamplesAnisotropy;
|
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){
|
public Device(PhysicalDevice PhysDevice){
|
||||||
|
|
||||||
Logger.debug("Creating Device Interface Layer");
|
Logger.debug("Creating Device Interface Layer");
|
||||||
try (var MemStack = MemoryStack.stackPush()) {
|
try (var MemStack = MemoryStack.stackPush()) {
|
||||||
PointerBuffer RequiredExtensions = CreateRequiredExtensions(PhysDevice, MemStack);
|
PointerBuffer RequiredExtensions = CreateRequiredExtensions(PhysDevice, MemStack);
|
||||||
|
|
@ -71,6 +85,16 @@ public class Device {
|
||||||
VkPhysicalDeviceProperties deviceProps = VkPhysicalDeviceProperties.malloc();
|
VkPhysicalDeviceProperties deviceProps = VkPhysicalDeviceProperties.malloc();
|
||||||
vkGetPhysicalDeviceProperties(PhysDevice.GetPhysicalDevice(), deviceProps);
|
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()) {
|
if (!deviceProps.limits().timestampComputeAndGraphics()) {
|
||||||
Logger.warn("GPU does not support timestamp queries!");
|
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() {
|
public boolean getDepthClamp() {
|
||||||
return depthClamp;
|
return depthClamp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue