From 7a79f444b247da53b9db035a2259179e4af5ddec Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 16 Aug 2023 21:38:23 +0900 Subject: [PATCH] apple m chip workaround --- .../graphics/glutils/Float16FrameBuffer.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/com/badlogic/gdx/graphics/glutils/Float16FrameBuffer.java b/src/com/badlogic/gdx/graphics/glutils/Float16FrameBuffer.java index fe86d306e..267be2be6 100644 --- a/src/com/badlogic/gdx/graphics/glutils/Float16FrameBuffer.java +++ b/src/com/badlogic/gdx/graphics/glutils/Float16FrameBuffer.java @@ -2,9 +2,13 @@ package com.badlogic.gdx.graphics.glutils; import com.badlogic.gdx.Application; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL30; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.utils.GdxRuntimeException; +import net.torvald.terrarum.App; + +// typealias Float16FrameBuffer = FloatFrameBuffer /** * Created by minjaesong on 2023-08-16. @@ -29,10 +33,18 @@ public class Float16FrameBuffer extends FrameBuffer { * @param hasDepth whether to attach a depth buffer * @throws GdxRuntimeException in case the FrameBuffer could not be created */ public Float16FrameBuffer (int width, int height, boolean hasDepth) { - FloatFrameBufferBuilder bufferBuilder = new FloatFrameBufferBuilder(width, height); - bufferBuilder.addFloatAttachment(GL30.GL_RGBA16F, GL30.GL_RGBA, GL30.GL_FLOAT, false); - if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer(); - this.bufferBuilder = bufferBuilder; + if (App.isAppleM) { // disable float framebuffer for Apple M chips + FrameBufferBuilder bufferBuilder = new FrameBufferBuilder(width, height); + bufferBuilder.addColorTextureAttachment(GL20.GL_RGBA, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE); + if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer(); + this.bufferBuilder = bufferBuilder; + } + else { + FloatFrameBufferBuilder bufferBuilder = new FloatFrameBufferBuilder(width, height); + bufferBuilder.addFloatAttachment(GL30.GL_RGBA16F, GL30.GL_RGBA, GL30.GL_FLOAT, false); + if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer(); + this.bufferBuilder = bufferBuilder; + } build(); }