Compare commits

..
8 changed files with 323 additions and 46 deletions

No files matched your search

@@ -16,6 +16,7 @@ import com.gtnewhorizons.angelica.glsm.stacks.LightModelStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.LightStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.MaterialStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.MatrixModeStack;
import com.gtnewhorizons.angelica.glsm.stacks.TextureBindingStack;
import com.gtnewhorizons.angelica.glsm.stacks.ViewPortStateStack;
import com.gtnewhorizons.angelica.glsm.states.Color4;
import com.gtnewhorizons.angelica.glsm.states.ISettableState;
@@ -66,7 +67,6 @@ import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.opengl.KHRDebug;
import java.lang.Math;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
@@ -1513,8 +1513,8 @@ public class GLStateManager {
GL11.glNewList(list, mode);
List<IStateStack<?>> stacks = Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS);
int size = stacks.size();
final int size = stacks.size();
//noinspection ForLoopReplaceableByForEach
for(int i = 0; i < size; i++) {
IStateStack<?> stack = stacks.get(i);
@@ -1525,6 +1525,12 @@ public class GLStateManager {
if(glListMode == GL11.GL_COMPILE) {
pushState(GL11.GL_ALL_ATTRIB_BITS);
}
// Band-aid fix to prevent color & texture leaks
color.setRed(-1);
color.setGreen(-1);
color.setBlue(-1);
textures.getTextureUnitBindings(getActiveTextureUnit()).setBinding(-1);
}
public static void glEndList() {
@@ -1540,12 +1546,33 @@ public class GLStateManager {
final Set<Map.Entry<IStateStack<?>, ISettableState<?>>> changedStates = new ObjectArraySet<>();
for(Map.Entry<IStateStack<?>, ISettableState<?>> entry : glListStates.entrySet()) {
// If the current stack state is different than the copy of the state at the start
if(!((ISettableState<?>)entry.getKey()).sameAs(entry.getValue())) {
if(!((ISettableState<?>)entry.getKey()).sameAs(entry.getValue())
&& !(entry.getKey() instanceof TextureBinding)
&& !(entry.getKey() instanceof Color4)) {
// Then we want to put into the change set the stack and the copy of the state now
changedStates.add(new AbstractMap.SimpleEntry<>(entry.getKey(), (ISettableState<?>) ((ISettableState<?>) entry.getKey()).copy()));
}
}
if(changedStates.size() != 0) {
final TextureBindingStack activeBinding = textures.getTextureUnitBindings(getActiveTextureUnit());
if (activeBinding.getBinding() != -1) {
changedStates.add(new AbstractMap.SimpleEntry<>(
activeBinding,
activeBinding.copy()
));
} else {
activeBinding.set(glListStates.get(activeBinding));
}
if (color.getRed() != -1 || color.getGreen() != -1 || color.getBlue() != -1) {
changedStates.add(new AbstractMap.SimpleEntry<>(
color,
color.copy()
));
} else {
color.set(glListStates.get(color));
}
if(!changedStates.isEmpty()) {
glListChanges.put(glListId, changedStates);
}
if(glListMode == GL11.GL_COMPILE) {
@@ -1566,8 +1593,9 @@ public class GLStateManager {
} else {
trySyncProgram();
GL11.glCallList(list);
if(glListChanges.containsKey(list)) {
for(Map.Entry<IStateStack<?>, ISettableState<?>> entry : glListChanges.get(list)) {
final Set<Map.Entry<IStateStack<?>, ISettableState<?>>> changes = glListChanges.get(list);
if(changes != null) {
for(Map.Entry<IStateStack<?>, ISettableState<?>> entry : changes) {
// Set the stack to the cached state at the end of the call list compilation
((ISettableState<?>)entry.getKey()).set(entry.getValue());
}
@@ -1,5 +1,22 @@
package com.gtnewhorizons.angelica.glsm.debug;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.glsm.states.TextureUnitArray;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joml.Matrix4f;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -9,14 +26,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joml.Matrix4f;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
// Adapted from https://github.com/makamys/CoreTweaks/blob/master/src/main/java/makamys/coretweaks/util/OpenGLDebugging.java;
// originally from https://github.com/TheGreyGhost/MinecraftByExample/blob/1-8final/src/main/java/minecraftbyexample/usefultools/OpenGLdebugging.java
@@ -30,7 +39,7 @@ public class OpenGLDebugging {
public static final String GL_GET_INTEGERV = "glGetIntegerv()";
public static final String GL_GET_FLOATV = "glGetFloatv()";
public class GLproperty {
public static class GLproperty {
public GLproperty(int glConstant, String name, String description, String category, String fetchCommand) {
this.gLConstant = glConstant;
@@ -445,11 +454,12 @@ public class OpenGLDebugging {
}
}
public static void checkGLSM() {
public static String getGLSMErrorLog() {
StringBuilder error = new StringBuilder();
boolean mismatch = false;
for (int i = 0; i < instance.propertyList.length; ++i) {
final GLproperty gLProperty = instance.propertyList[i];
if(gLProperty.fetchCommand.equals(GL_GET_FLOATV) && gLProperty.name.endsWith("_MATRIX")) {
if (gLProperty.fetchCommand.equals(GL_GET_FLOATV) && gLProperty.name.endsWith("_MATRIX")) {
final Matrix4f cached = gLProperty.getAsMatrix4f(true);
final Matrix4f uncached = gLProperty.getAsMatrix4f(false);
// Some precision issues due to RAD vs degrees, and translated (vs f)
@@ -461,14 +471,87 @@ public class OpenGLDebugging {
final String cached = gLProperty.getAsString(true);
final String uncached = gLProperty.getAsString(false);
if (!cached.equals(uncached)) {
LOGGER.error("GLSM mismatch: " + gLProperty.name + " cached: " + cached + " uncached: " + uncached);
error.append("GLSM mismatch: " + gLProperty.name + " cached: " + cached + " uncached: " + uncached);
error.append('\n');
mismatch = true;
}
}
}
final TextureUnitArray textureUnits = GLStateManager.getTextures();
int currentActiveTexture = GLStateManager.getActiveTextureUnit();
for (int i = 0; i < textureUnits.textureMatricies.length; i++) {
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0 + i);
final boolean cached = GLStateManager.glIsEnabled(GL11.GL_TEXTURE_2D);
final boolean uncached = GL11.glIsEnabled(GL11.GL_TEXTURE_2D);
if (cached != uncached) {
error.append("GLSM mismatch: " + "GL_TEXTURE_2D" + " cached: " + cached + " uncached: " + uncached + ", texture unit: GL_TEXTURE" + i);
error.append('\n');
mismatch = true;
}
}
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0 + currentActiveTexture);
if (!mismatch) {
return null;
}
return error.toString();
}
public static void checkGLSM() {
String output = getGLSMErrorLog();
if (output == null) {
LOGGER.info("GLSM state matches!");
} else {
LOGGER.error(output);
}
}
public static void copyTexture(ResourceLocation resource, File output) {
Object object = Minecraft.getMinecraft().renderEngine.mapTextureObjects.get(resource);
if (object != null) {
copyTexture(((ITextureObject) object).getGlTextureId(), output);
}
}
public static void copyTexture(int textureID, File output) {
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
BufferedImage bufferedimage = new BufferedImage(width, height, 1);
final int[] pixelValues = ((DataBufferInt) bufferedimage.getRaster().getDataBuffer()).getData();
IntBuffer pixelBuffer = BufferUtils.createIntBuffer(pixelValues.length);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
pixelBuffer.get(pixelValues);
// Flip texture
final int halfHeight = height / 2;
final int[] rowBuffer = new int[width];
for (int y = 0; y < halfHeight; y++) {
final int top = y * width;
final int bottom = (height - 1 - y) * width;
System.arraycopy(pixelValues, top, rowBuffer, 0, width);
System.arraycopy(pixelValues, bottom, pixelValues, top, width);
System.arraycopy(rowBuffer, 0, pixelValues, bottom, width);
}
File dir = output.getParentFile();
dir.mkdirs();
copyBufferedImageToFile(bufferedimage, output);
bufferedimage.flush();
}
private static void copyBufferedImageToFile(BufferedImage image, File file) {
try {
ImageIO.write(image, "png", file);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -4,19 +4,30 @@ package jss.notfine.render;
import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VBOManager;
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import jss.notfine.core.Settings;
import jss.util.RandomXoshiro256StarStar;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
public class RenderStars {
//private static final ResourceLocation locationStarsPng = new ResourceLocation("textures/colormap/stars.png");
public static void reloadStarRenderList(RenderGlobal render) {
TessellatorManager.startCapturing();
renderStars();
VBOManager.registerVBO(render.starGLCallList, TessellatorManager.stopCapturingToVBO(DefaultVertexFormat.POSITION));
if(AngelicaConfig.enableVBO) {
TessellatorManager.startCapturing();
renderStars();
VBOManager.registerVBO(render.starGLCallList, TessellatorManager.stopCapturingToVBO(DefaultVertexFormat.POSITION));
} else {
GL11.glPushMatrix();
GL11.glNewList(render.starGLCallList, GL11.GL_COMPILE);
renderStars();
GL11.glEndList();
GL11.glPopMatrix();
}
}
public static void renderStars() {
@@ -46,10 +46,13 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
private static final Logger LOGGER = LogManager.getLogger("ChunkBuilder");
private final Deque<WrappedTask<T>> buildQueue = new ConcurrentLinkedDeque<>();
// special queue for tasks that will block until the main thread finalizes them
private final Deque<WrappedTask<T>> buildQueueKnownBlocking = new ConcurrentLinkedDeque<>();
private final Deque<ChunkBuildResult<T>> uploadQueue = new ConcurrentLinkedDeque<>();
private final Deque<Throwable> failureQueue = new ConcurrentLinkedDeque<>();
private final Object jobNotifier = new Object();
private final Object jobNotifierKnownBlocking = new Object();
private final AtomicBoolean running = new AtomicBoolean(false);
private final List<Thread> threads = new ArrayList<>();
@@ -60,6 +63,7 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
private Vector3d cameraPosition = new Vector3d();
private final int limitThreads;
private final int limitThreadsBlocking;
private final ChunkVertexType vertexType;
private final ChunkRenderBackend<T> backend;
@@ -67,6 +71,7 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
this.vertexType = vertexType;
this.backend = backend;
this.limitThreads = getThreadCount();
this.limitThreadsBlocking = this.limitThreads;
}
/**
@@ -74,7 +79,7 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
* spawn more tasks than the budget allows, it will block until resources become available.
*/
public int getSchedulingBudget() {
return Math.max(0, (this.limitThreads * TASK_QUEUE_LIMIT_PER_WORKER) - this.buildQueue.size());
return Math.max(0, (this.limitThreads * TASK_QUEUE_LIMIT_PER_WORKER) - this.buildQueue.size() - this.buildQueueKnownBlocking.size());
}
/**
@@ -96,7 +101,7 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
ChunkBuildBuffers buffers = new ChunkBuildBuffers(this.vertexType);
ChunkRenderCacheLocal pipeline = new ChunkRenderCacheLocal(client, this.world);
WorkerRunnable worker = new WorkerRunnable(buffers, pipeline);
WorkerRunnable worker = new WorkerRunnable(i, buffers, pipeline, this.world, false);
Thread thread = new Thread(worker, "Chunk Render Task Executor #" + i);
thread.setPriority(Math.max(0, Thread.NORM_PRIORITY - 2));
@@ -105,6 +110,19 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
this.threads.add(thread);
}
for (int i = 0; i < this.limitThreadsBlocking; i++) {
ChunkBuildBuffers buffers = new ChunkBuildBuffers(this.vertexType);
ChunkRenderCacheLocal pipeline = new ChunkRenderCacheLocal(client, this.world);
WorkerRunnable worker = new WorkerRunnable(this.limitThreads + i, buffers, pipeline, this.world, true);
Thread thread = new Thread(worker, "Chunk Render Blocking Task Executor #" + i);
thread.setPriority(Math.max(0, Thread.NORM_PRIORITY - 2));
thread.start();
this.threads.add(thread);
}
LOGGER.info("Started {} worker threads", this.threads.size());
}
@@ -137,6 +155,9 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
synchronized (this.jobNotifier) {
this.jobNotifier.notifyAll();
}
synchronized (this.jobNotifierKnownBlocking) {
this.jobNotifierKnownBlocking.notifyAll();
}
// Keep processing the main thread tasks so the workers don't block forever
AngelicaRenderQueue.managedBlock(() -> !workersAlive());
@@ -159,7 +180,12 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
job.future.cancel(true);
}
for (WrappedTask<?> job : this.buildQueueKnownBlocking) {
job.future.cancel(true);
}
this.buildQueue.clear();
this.buildQueueKnownBlocking.clear();
this.world = null;
this.sectionCache = null;
@@ -200,7 +226,7 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
if (this.uploadQueue.isEmpty()) {
return false;
}
this.backend.upload(RenderDevice.INSTANCE.createCommandList(), filterChunkBuilds(new DequeDrain<>(this.uploadQueue)));
return true;
@@ -256,7 +282,7 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
* @return True if the build queue is empty
*/
public boolean isBuildQueueEmpty() {
return this.buildQueue.isEmpty();
return this.buildQueue.isEmpty() && this.buildQueueKnownBlocking.isEmpty();
}
/**
@@ -388,9 +414,18 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
// caches between different CPU cores
private final ChunkRenderCacheLocal cache;
public WorkerRunnable(ChunkBuildBuffers bufferCache, ChunkRenderCacheLocal cache) {
private final WorldClient world;
private final int i;
private final boolean allowBlocking;
public WorkerRunnable(int i, ChunkBuildBuffers bufferCache, ChunkRenderCacheLocal cache, WorldClient world, boolean allowBlocking) {
this.i = i;
this.bufferCache = bufferCache;
this.cache = cache;
this.world = world;
this.allowBlocking = allowBlocking;
}
@Override
@@ -404,6 +439,15 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
continue;
}
// Relegate tasks that can block for an extended period of time to a separate threadpool.
if (!this.allowBlocking && job.task.willRenderInMainThread(this.cache)) {
ChunkBuilder.this.buildQueueKnownBlocking.add(job);
synchronized (ChunkBuilder.this.jobNotifierKnownBlocking) {
ChunkBuilder.this.jobNotifierKnownBlocking.notify();
}
continue;
}
ChunkBuildResult<T> result;
try {
@@ -435,18 +479,33 @@ public class ChunkBuilder<T extends ChunkGraphicsState> {
* currently available, it will wait on {@link ChunkBuilder#jobNotifier} field until notified.
*/
private WrappedTask<T> getNextJob() {
WrappedTask<T> job = ChunkBuilder.this.buildQueue.poll();
if (this.allowBlocking) {
WrappedTask<T> job = ChunkBuilder.this.buildQueueKnownBlocking.poll();
if (job == null) {
synchronized (ChunkBuilder.this.jobNotifier) {
try {
ChunkBuilder.this.jobNotifier.wait();
} catch (InterruptedException ignored) {
if (job == null) {
synchronized (ChunkBuilder.this.jobNotifierKnownBlocking) {
try {
ChunkBuilder.this.jobNotifierKnownBlocking.wait();
} catch (InterruptedException ignored) {
}
}
}
}
return job;
return job;
} else {
WrappedTask<T> job = ChunkBuilder.this.buildQueue.poll();
if (job == null) {
synchronized (ChunkBuilder.this.jobNotifier) {
try {
ChunkBuilder.this.jobNotifier.wait();
} catch (InterruptedException ignored) {
}
}
}
return job;
}
}
}
@@ -32,6 +32,7 @@ public abstract class ChunkRenderBuildTask<T extends ChunkGraphicsState> {
public abstract ChunkBuildResult<T> performBuild(ChunkRenderCacheLocal cache, ChunkBuildBuffers buffers,
CancellationSource cancellationSource);
public boolean willRenderInMainThread(ChunkRenderCacheLocal cache) { return false; };
/**
* Called on the main render thread when the task's execution returns. The implementation should release any
* resources it's still holding onto at this point.
@@ -61,13 +61,15 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
private final boolean translucencySorting;
private boolean hasMainThreadBlocks = false;
private boolean hasMainThreadBlocksComputed = false;
public ChunkRenderRebuildTask(ChunkRenderContainer<T> render, ChunkRenderContext context, BlockPos offset) {
this.render = render;
this.offset = offset;
this.context = context;
this.camera = new Vector3d();
this.translucencySorting = SodiumClientMod.options().advanced.translucencySorting;
}
public ChunkRenderRebuildTask<T> withCameraPosition(Vector3d camera) {
@@ -122,6 +124,48 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
return canRender;
}
public boolean willRenderInMainThread(ChunkRenderCacheLocal cache) {
if (hasMainThreadBlocksComputed)
return hasMainThreadBlocks;
final ChunkRenderData.Builder renderData = new ChunkRenderData.Builder();
final ChunkOcclusionDataBuilder occluder = new ChunkOcclusionDataBuilder();
final ChunkRenderBounds.Builder bounds = new ChunkRenderBounds.Builder();
cache.init(this.context);
final WorldSlice slice = cache.getWorldSlice();
final int baseX = this.render.getOriginX();
final int baseY = this.render.getOriginY();
final int baseZ = this.render.getOriginZ();
final BlockPos pos = new BlockPos();
outer:
for (int relY = 0; relY < 16; relY++) {
for (int relZ = 0; relZ < 16; relZ++) {
for (int relX = 0; relX < 16; relX++) {
final Block block = slice.getBlockRelative(relX + 16, relY + 16, relZ + 16);
// If the block is vanilla air, assume it renders nothing. Don't use isAir because mods
// can abuse it for all sorts of things
if (block.getMaterial() == Material.air) {
continue;
}
if (!rendersOffThread(block)) {
hasMainThreadBlocks = true;
break outer;
}
}
}
}
hasMainThreadBlocksComputed = true;
return hasMainThreadBlocks;
}
@Override
public ChunkBuildResult<T> performBuild(ChunkRenderCacheLocal cache, ChunkBuildBuffers buffers, CancellationSource cancellationSource) {
final ChunkRenderData.Builder renderData = new ChunkRenderData.Builder();
@@ -147,7 +191,6 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
final BlockPos renderOffset = this.offset;
final LongArrayFIFOQueue mainThreadBlocks = new LongArrayFIFOQueue();
boolean hasMainThreadBlocks = false;
for (int relY = 0; relY < 16; relY++) {
if (cancellationSource.isCancelled()) {
@@ -242,6 +285,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
handleRenderBlocksTextures(renderBlocks, renderData);
hasMainThreadBlocksComputed = true;
if(hasMainThreadBlocks) {
// Render the other blocks on the main thread
var future = CompletableFuture.runAsync(() -> this.performMainBuild(cache, buffers, cancellationSource, bounds, renderData, mainThreadBlocks), AngelicaRenderQueue.executor());
@@ -350,6 +394,8 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
+ camera
+ ", translucencySorting="
+ translucencySorting
+ ", hasMainThreadBlocks="
+ hasMainThreadBlocks
+ '}';
}
@@ -2,6 +2,8 @@ options.button.shader=光影包……
options.chunks=%s 区块
options.entityShadows=实体阴影
options.droppedItems=%s 个物品
options.droppedItems.max=无限制
sodium.option_impact.low=低
sodium.option_impact.medium=中
sodium.option_impact.high=高
@@ -29,6 +31,8 @@ sodium.options.leaves_quality.name=树叶质量
sodium.options.leaves_quality.tooltip=控制树叶的渲染质量。
sodium.options.grass_quality.name=草方块质量
sodium.options.grass_quality.tooltip=控制草方块侧面的质量。
sodium.options.sodium_smooth_lighting.name=Sodium平滑光照
sodium.options.sodium_smooth_lighting.tooltip=如果启用,将调用钠模组的平滑光照,此选项仅在平滑光照启用时生效。
sodium.options.particle_quality.name=粒子效果
sodium.options.particle_quality.tooltip=控制可同时在画面上渲染的最大粒子数量。
sodium.options.smooth_lighting.tooltip=控制方块是否平滑光照和渲染。这会略微增加重新加载区块所需的时间,但不会影响帧率(FPS)。
@@ -38,7 +42,7 @@ sodium.options.entity_distance.tooltip=实体渲染的距离修正乘数。更
sodium.options.entity_shadows.tooltip=如果启用,将在生物和其他实体下方渲染简单的阴影。
sodium.options.vignette.name=晕影
sodium.options.vignette.tooltip=如果启用,将在玩家的画面上显示晕影效果。除非你的显卡像素填充率有限,否则这不太可能对帧率产生影响。
sodium.options.mipmap_levels.tooltip=控制将用于方块模型纹理的MipMap的数量。较高的值可以更好地渲染远处的方块,但可能会对许多纹理动画的性能产生不利影响。
sodium.options.mipmap_levels.tooltip=控制多级纹理的生成等级。较高的等级可以更好地渲染远处的方块,但可能会对许多纹理动画的性能产生不利影响。
sodium.options.use_chunk_multidraw.name=使用区块多重绘制
sodium.options.use_chunk_multidraw.tooltip=多重绘制允许通过更少的绘制请求来进行多区块渲染,在大大减少了渲染世界时的CPU负载的同时也可能提高了GPU利用率。此选项可能会让一些图形驱动程序出现问题,因此如果遇到相关问题,应尝试禁用它。
sodium.options.use_vertex_objects.name=使用顶点数组对象
@@ -61,7 +65,7 @@ sodium.options.cpu_render_ahead_limit.name=CPU 预渲染限制
sodium.options.cpu_render_ahead_limit.tooltip=指定CPU可以在GPU上等待完成渲染的最大帧数。非常低或非常高的值都可能会导致帧率(FPS)不稳定。
sodium.options.cpu_render_ahead_limit.value=%s 帧
sodium.options.allow_direct_memory_access.name=允许直接内存访问
sodium.options.allow_direct_memory_access.tooltip=如果启用,将允许某些关键代码路径使用直接内存访问来提高性能。这通常会大大减少区块和实体渲染的 CPU 开销,但会使诊断某些错误和崩溃变得更加困难。只有您被要求这么做或知道在做什么时,才应该禁用它。
sodium.options.allow_direct_memory_access.tooltip=如果启用,一些关键代码将被允许通过直接读写内存来提高性能。这通常会大大减少区块和实体渲染的CPU开销,但会使诊断某些错误和崩溃变得更加困难。只有您被要求这么做或知道在做什么时,才应该禁用它。
sodium.options.ignore_driver_blacklist.name=忽略驱动程序冲突
sodium.options.ignore_driver_blacklist.tooltip=如果启用,已知的硬件/驱动程序配置不兼容性将被忽略,以允许您启用那些可能导致游戏问题的配置.请勿更改此项除非您确切知道您在做什么.更改此选项后,必须保存、关闭,然后重新打开设置菜单。
sodium.options.enable_memory_tracing.name=启用内存跟踪
@@ -78,10 +82,10 @@ sodium.options.chunk_update_threads.tooltip=指定用于区块构建的线程数
sodium.options.always_defer_chunk_updates.name=始终推迟区块更新
sodium.options.always_defer_chunk_updates.tooltip=如果启用,渲染将永远不会等待区块更新完成,即使它们很重要。这在某些情况下可以极大地提高帧率(FPS),但可能会在游戏时产生明显的视觉滞后。
sodium.options.use_no_error_context.name=使用禁用错误检查的上下文
sodium.options.use_no_error_context.tooltip=如果启用,OpenGL上下文将在禁用错误检查的情况下创建。这可能会略微提高性能,但也会增加游戏崩溃的风险,而不会优雅地处理OpenGL错误。如果遇到无法解释的突然崩溃,则应禁用此选项。
sodium.options.use_no_error_context.tooltip=如果启用,OpenGL日志将不包含详细错误信息。这可能略微提高性能,但也可能因为无法精确处理OpenGL错误而导致游戏崩溃。如遇到不明原因的突然崩溃,则应禁用此选项。
sodium.options.threads.value=%s 线程
sodium.options.use_gl_state_cache.name=使用GL状态缓存
sodium.options.use_gl_state_cache.tooltip=如果启用,OpenGL状态缓存将减少冗余状态更改的次数.这可以提高性能,但也可能导致一些模组出现问题.每次重启游戏时此项将重置.
sodium.options.use_gl_state_cache.name=启用GL状态缓存
sodium.options.use_gl_state_cache.tooltip=如果启用,OpenGL状态缓存将减少冗余状态更改的次数。这可以提高性能,但也可能导致一些模组出现问题。每次重启游戏时此项将重置。
sodium.options.default=默认
sodium.options.buttons.undo=撤销
sodium.options.buttons.apply=应用
@@ -89,7 +93,7 @@ sodium.options.buttons.donate=给JellySquid买杯咖啡!
options.dynamic_fov=动态视场
options.dynamic_fov.tooltip=如果启用,游戏视场将根据玩家速度发生变化.
options.framerate=%s FPS
iris.shaders.toggled=光影包已切换到 %s!
iris.shaders.toggled=光影包已切换为 %s!
iris.shaders.disabled=光影包已禁用!
options.iris.apply=应用
options.iris.refresh=刷新
@@ -122,12 +126,48 @@ options.iris.setToDefault=将选项设为默认值?
options.iris.profile=配置文件
options.iris.profile.custom=自定义
options.iris.shadowDistance=最大阴影距离
options.iris.shadowDistance.sodium_tooltip=最大阴影距离
options.iris.shadowDistance.enabled=更改渲染阴影的最远距离。超出此距离的地形和实体不会投射出阴影。减少阴影渲染距离可以显著提高性能。
options.iris.shadowDistance.disabled=当前光影包已重设阴影渲染距离,无法更改.
options.iris.shadowDistance.disabled=当前光影包已重设阴影渲染距离,无法更改
options.iris.gui.hide=隐藏 GUI
options.iris.gui.show=显示 GUI
options.dynamic_lights=动态光源
options.dynamic_lights.tooltip=启用动态光源. 模式选择: OFF - 关闭, FASTEST - 500ms延迟, FAST - 250ms延迟, FANCY - 无延迟. 如果正在使用光影则此功能被禁用.
options.dynamic_lights.tooltip=启用动态光源,模式选择:OFF-关闭,FASTEST-500ms延迟,FAST-250ms延迟,FANCY-无延迟
options.dynamic_lights_shader_force=强制启用动态光源
options.dynamic_lights_shader_force.tooltip=启用-启用光影时仍显示动态光源;禁用-启用光影时禁用动态光源。
options.angelica.fontconfig=字体配置...
options.angelica.fontconfig.title=字体配置
options.angelica.fontconfig.currentfonts=主字体:§e%s§r 备用字体:§b%s
options.angelica.fontconfig.searchprompt=§7§o搜索字体...
options.angelica.fontconfig.disable_custom_font=禁用自定义字体
options.angelica.fontconfig.enable_custom_font=启用自定义字体
options.angelica.fontconfig.reset_values=恢复默认配置
options.angelica.fontconfig.font_quality=字体渲染质量:%s
options.angelica.fontconfig.shadow_offset=阴影偏移:%s
options.angelica.fontconfig.glyph_scale=字体缩放:%s
options.angelica.fontconfig.glyph_aspect=字体宽高比:%s
options.angelica.fontconfig.whitespace_scale=空白字符大小:%s
options.angelica.fontconfig.glyph_spacing=字符间距:%s
options.angelica.fontconfig.font_aa_strength=字体抗锯齿强度:%s
options.angelica.fontconfig.aamode.aa_none=抗锯齿:关闭
options.angelica.fontconfig.aamode.aa_4x=抗锯齿:4x MSAA
options.angelica.fontconfig.aamode.aa_16x=抗锯齿:16x MSAA
options.angelica.fontconfig.font_quality.tooltip=自定义字体渲染质量,使其不那么像素化,但会牺牲一些性能与内存占用。
options.angelica.fontconfig.shadow_offset.tooltip=字体衬底阴影偏移的距离。同时影响§l粗体§r文本的绘制方式;如果看到重影的文本,请调低此值。
options.angelica.fontconfig.glyph_scale.tooltip=字体大小的缩放比例。极端值可能使游戏难以游玩。
options.angelica.fontconfig.glyph_aspect.tooltip=字体的的宽高比例
options.angelica.fontconfig.whitespace_scale.tooltip=空白字符(如空格)的缩放比例
options.angelica.fontconfig.glyph_spacing.tooltip=字符之间的间距
options.angelica.fontconfig.font_aa_strength.tooltip=抗锯齿所使用的采样间距。过大可能导致字体看起来模糊,过小可能导致锯齿。请根据您的实际情况选择最佳值。
options.angelica.fontconfig.aamode.tooltip=抗锯齿模式。可以显著改善缩放或斜角观看文本的外观和可读性,但会牺牲一些性能。
options.angelica.droppedItemLimit=掉落物渲染数量上限
options.angelica.droppedItemLimit.tooltip=将被渲染的掉落物的最大数量。较小的值可以提高性能。
options.angelica.mobSpawnerRenderDistance=刷怪笼渲染距离
options.angelica.mobSpawnerRenderDistance.tooltip=刷怪笼内旋转实体的渲染距离
options.angelica.itemdisplaylistcount=物品渲染器缓存限制
options.angelica.itemdisplaylistcount.tooltip=优化物品渲染器中的缓存数量上限。较高的值将显著提高性能,但可能导致显存占用增加
options.angelica.sleepbeforeswap=备用FPS限制器
options.angelica.sleepbeforeswap.tooltip=切换到备用FPS限制器,可以降低帧波动,但会略微增加延迟。最多只会造成一帧的延迟,且在较高帧率下影响较小。
pack.iris.select.title=选择
pack.iris.configure.title=配置
label.iris.true=开启
@@ -136,7 +136,16 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
*/
@Overwrite
public boolean updateRenderers(EntityLivingBase e, boolean b){
AngelicaRenderQueue.processTasks(1);
final int BUDGET_NS = 5 * 1000 * 1000;
long startTime = System.nanoTime();
for (;;) {
int tasksRan = AngelicaRenderQueue.processTasks(1);
if (tasksRan == 0)
break;
long elapsedTime = System.nanoTime() - startTime;
if (elapsedTime > BUDGET_NS)
break;
}
return true;
}